Trait MessageHandler

Source
pub trait MessageHandler:
    InventoryItemProvider
    + Send
    + Sync {
    type Input: TypeInfo + DeserializeOwned + Serialize + Send + Sync;
    type Output: TypeInfo + DeserializeOwned + Serialize + Send + Sync;

    // Required method
    fn handle<'async_trait>(
        data: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, String>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Trait for messages that can be handled by the runtime

Required Associated Types§

Required Methods§

Source

fn handle<'async_trait>( data: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, String>> + Send + 'async_trait>>
where Self: 'async_trait,

Handle the message

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§