Trait bttp::MsgCallback

source ·
pub trait MsgCallback: Clone + Send + Sync + Unpin {
    type Arg<'de>: CallMsg<'de>
       where Self: 'de;
    type CallFut<'de>: Future<Output = Result<()>> + Send
       where Self: 'de;

    // Required method
    fn call<'de>(
        &'de self,
        arg: MsgReceived<Self::Arg<'de>>
    ) -> Self::CallFut<'de>;
}
Expand description

Trait for types which can be called to handle messages received over the network. The server loop in Receiver uses a type that implements this trait to react to messages it receives.

Required Associated Types§

source

type Arg<'de>: CallMsg<'de> where Self: 'de

source

type CallFut<'de>: Future<Output = Result<()>> + Send where Self: 'de

Required Methods§

source

fn call<'de>(&'de self, arg: MsgReceived<Self::Arg<'de>>) -> Self::CallFut<'de>

Implementations on Foreign Types§

source§

impl<T: MsgCallback> MsgCallback for &T

§

type Arg<'de> where Self: 'de = <T as MsgCallback>::Arg<'de>

§

type CallFut<'de> where Self: 'de = <T as MsgCallback>::CallFut<'de>

source§

fn call<'de>(&'de self, arg: MsgReceived<Self::Arg<'de>>) -> Self::CallFut<'de>

Implementors§