Trait nbio::Receive

source ·
pub trait Receive: Session {
    type ReceivePayload<'a>
       where Self: 'a;

    // Required method
    fn receive<'a>(
        &'a mut self
    ) -> Result<ReceiveOutcome<Self::ReceivePayload<'a>>, Error>;
}
Expand description

A Session implementation that can receive payloads via polling.

Required Associated Types§

source

type ReceivePayload<'a> where Self: 'a

The type returned by the receive(..) function.

Required Methods§

source

fn receive<'a>( &'a mut self ) -> Result<ReceiveOutcome<Self::ReceivePayload<'a>>, Error>

Attempt to receive a payload from the session. This will return ReceiveOutcome::Payload when data has been received. ReceiveOutcome::Buffered can be used to report that work was completed, but data is not ready. This means that only [ReceiveOutcome::None] should be used to indicate to a scheduler that yielding or idling is appropriate.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Receive for HttpClientSession

source§

impl Receive for TcpSession

§

type ReceivePayload<'a> = &'a [u8]

source§

impl Receive for WebSocketSession

§

type ReceivePayload<'a> = Message<'a>

source§

impl<MapFunc, Sess, ReceivePayload> Receive for MappingReceiver<MapFunc, Sess, ReceivePayload>
where MapFunc: for<'a> Fn(Sess::ReceivePayload<'a>) -> ReceivePayload + 'static, Sess: Receive + Publish, ReceivePayload: 'static,

§

type ReceivePayload<'a> = ReceivePayload where Self: 'a

source§

impl<R, W> Receive for MockSession<R, W>
where R: 'static, W: 'static,

§

type ReceivePayload<'a> = R

source§

impl<S> Receive for LivenessSession<S>
where S: Receive + 'static,

§

type ReceivePayload<'a> = <S as Receive>::ReceivePayload<'a>

source§

impl<S, DF, SF> Receive for FrameDuplex<S, DF, SF>
where S: for<'a> Publish<PublishPayload<'a> = &'a [u8]> + for<'a> Receive<ReceivePayload<'a> = &'a [u8]> + 'static, DF: DeserializeFrame + 'static, SF: SerializeFrame + 'static,

source§

impl<S, F> Receive for FrameReceiver<S, F>
where S: for<'a> Receive<ReceivePayload<'a> = &'a [u8]> + 'static, F: DeserializeFrame + 'static,

source§

impl<S, F> Receive for HeartbeatingSession<S, F>
where S: Receive + Publish + 'static, F: for<'a> FnMut(&mut S) -> Result<HeartbeatOutcome, Error> + 'static,

§

type ReceivePayload<'a> = <S as Receive>::ReceivePayload<'a>

source§

impl<Sess, Payload, QueueImpl> Receive for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,

§

type ReceivePayload<'a> = Payload where Self: 'a