persistcli::maelstrom::node

Trait Service

Source
pub trait Service:
    Sized
    + Send
    + Sync {
    // Required methods
    fn init<'life0, 'life1, 'async_trait>(
        args: &'life0 Args,
        handle: &'life1 Handle,
    ) -> Pin<Box<dyn Future<Output = Result<Self, MaelstromError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn eval<'life0, 'async_trait>(
        &'life0 self,
        handle: Handle,
        src: NodeId,
        req: Body,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An implementor of a Maelstrom workload.

Required Methods§

Source

fn init<'life0, 'life1, 'async_trait>( args: &'life0 Args, handle: &'life1 Handle, ) -> Pin<Box<dyn Future<Output = Result<Self, MaelstromError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Construct this service.

Maelstrom services are available via the Handle.

Source

fn eval<'life0, 'async_trait>( &'life0 self, handle: Handle, src: NodeId, req: Body, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Respond to a single request.

Implementations must either panic or respond by calling Handle::send_res exactly once.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Service for persistcli::maelstrom::txn_list_append_multi::TransactorService

Source§

impl Service for persistcli::maelstrom::txn_list_append_single::TransactorService