Subscription

Trait Subscription 

Source
pub trait Subscription {
    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        message: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, SubscriptionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn weak_handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, SubscriptionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait describing how incoming messages on [Console] must be handled.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, message: Bytes, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, SubscriptionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles strongly-typed messages.

Return optional Bytes that will be sent back to the message sender.

Source

fn weak_handle<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, SubscriptionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handles free-form text messages.

Returns an optional String, which, if provided, will be sent back to the message sender.

Implementors§