Trait nbio::Publish

source ·
pub trait Publish: Session {
    type PublishPayload<'a>
       where Self: 'a;

    // Required method
    fn publish<'a>(
        &mut self,
        payload: Self::PublishPayload<'a>
    ) -> Result<PublishOutcome<Self::PublishPayload<'a>>, Error>;
}
Expand description

A Session implementation that can publish payloads.

Required Associated Types§

source

type PublishPayload<'a> where Self: 'a

The type given to the publish(..) function.

Required Methods§

source

fn publish<'a>( &mut self, payload: Self::PublishPayload<'a> ) -> Result<PublishOutcome<Self::PublishPayload<'a>>, Error>

Write the given payload to the session.

This will return PublishOutcome::Incomplete if the publish is not immediately completed fully, in which case T of Incomplete(T) data must be retried.

Note that it is possible for some implementations that a publish is partially complete, so you must re-attempt the data encapsulated by Incomplete, not the data originally passed into the function. This guidance can only be ignored when you are not writing generic code and you know that your Publish impl is “all-or-none”.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Publish for HttpClientSession

source§

impl Publish for TcpSession

§

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

source§

impl Publish for WebSocketSession

§

type PublishPayload<'a> = Message<'a>

source§

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

§

type PublishPayload<'a> = <Sess as Publish>::PublishPayload<'a> where Self: 'a

source§

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

§

type PublishPayload<'a> = W

source§

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

§

type PublishPayload<'a> = <S as Publish>::PublishPayload<'a>

source§

impl<S, C> Publish for CallbackDriver<S, C>
where S: Publish + Receive, C: for<'a> Callback<S::ReceivePayload<'a>> + 'static,

§

type PublishPayload<'a> = <S as Publish>::PublishPayload<'a> where Self: 'a

source§

impl<S, C> Publish for CallbackRefDriver<S, C>
where S: Publish + Receive, C: for<'a> CallbackRef<S::ReceivePayload<'a>> + 'static,

§

type PublishPayload<'a> = <S as Publish>::PublishPayload<'a> where Self: 'a

source§

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

source§

impl<S, F> Publish for FramePublisher<S, F>
where S: for<'a> Publish<PublishPayload<'a> = &'a [u8]> + 'static, F: SerializeFrame + 'static,

source§

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

§

type PublishPayload<'a> = <S as Publish>::PublishPayload<'a>

source§

impl<Sess, Payload, QueueImpl> Publish for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Publish, QueueImpl: Queue<Payload> + 'static, Payload: 'static,

§

type PublishPayload<'a> = <Sess as Publish>::PublishPayload<'a> where Self: 'a