pub trait SendNonBlocking<T>: Debug + Display {
    // Required method
    fn send(&mut self, msg: &mut T) -> Result<SendStatus, Error>;

    // Provided methods
    fn send_busywait_timeout(
        &mut self,
        msg: &mut T,
        timeout: Duration
    ) -> Result<SendStatus, Error> { ... }
    fn send_busywait(&mut self, msg: &mut T) -> Result<(), Error> { ... }
}

Required Methods§

source

fn send(&mut self, msg: &mut T) -> Result<SendStatus, Error>

The call will internally serialize the T and attempt to write the resulting bytes into a stream. If there was a successfull attempt which wrote some, not all, bytes from serialized message into the stream and hence the write was only partial, the call will busy wait until all of remaining bytes are written before returning SendStatus::Completed. SendStatus::WouldBlock is returned only if the attempt did not write any bytes to the stream after the first attempt

§Important

Provided Methods§

source

fn send_busywait_timeout( &mut self, msg: &mut T, timeout: Duration ) -> Result<SendStatus, Error>

Will call Self::send until it returns SendStatus::Completed or SendStatus::WouldBlock after the timeout, while propagating all errors from Self::send

§Warning

Consider overriding this default implementation if your Self::send implementation issues callback functions calls which must be called once and only once.

source

fn send_busywait(&mut self, msg: &mut T) -> Result<(), Error>

Will call Self::send until it returns SendStatus::Completed

§Warning

Consider overriding this default implementation if your Self::send implementation issues callback functions calls which must be called once and only once.

Implementors§

source§

impl<M: Messenger, S: SendNonBlocking<M::SendT> + ConnectionStatus> SendNonBlocking<<M as Messenger>::SendT> for CltSendersPool<M, S>

source§

impl<P: Protocol, C: CallbackRecvSend<P>, const MAX_MSG_SIZE: usize> SendNonBlocking<<P as Messenger>::SendT> for Clt<P, C, MAX_MSG_SIZE>

source§

impl<P: Protocol, C: CallbackRecvSend<P>, const MAX_MSG_SIZE: usize> SendNonBlocking<<P as Messenger>::SendT> for CltsPool<P, C, MAX_MSG_SIZE>

source§

impl<P: Protocol, C: CallbackRecvSend<P>, const MAX_MSG_SIZE: usize> SendNonBlocking<<P as Messenger>::SendT> for Svc<P, C, MAX_MSG_SIZE>

source§

impl<P: Protocol, C: CallbackSend<P>, const MAX_MSG_SIZE: usize> SendNonBlocking<<P as Messenger>::SendT> for CltSender<P, C, MAX_MSG_SIZE>

source§

impl<P: Protocol, C: CallbackSend<P>, const MAX_MSG_SIZE: usize> SendNonBlocking<<P as Messenger>::SendT> for CltSenderRef<P, C, MAX_MSG_SIZE>