Trait links_nonblocking::core::SendNonBlocking
source · 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§
sourcefn send(&mut self, msg: &mut T) -> Result<SendStatus, Error>
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
- The implementation will trigger crate::prelude::Protocol & links_core::prelude::CallbackSend hooks
Provided Methods§
sourcefn send_busywait_timeout(
&mut self,
msg: &mut T,
timeout: Duration
) -> Result<SendStatus, Error>
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.
sourcefn send_busywait(&mut self, msg: &mut T) -> Result<(), Error>
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.