pub struct MessageSender<M: Messenger, const MAX_MSG_SIZE: usize> { /* private fields */ }
Expand description

Represents an abstraction for sending exactly one message utilizing the underlying FrameWriter

Implementations§

source§

impl<M: Messenger, const MAX_MSG_SIZE: usize> MessageSender<M, MAX_MSG_SIZE>

source

pub fn new(con_id: ConId, stream: TcpStream) -> Self

Trait Implementations§

source§

impl<M: Debug + Messenger, const MAX_MSG_SIZE: usize> Debug for MessageSender<M, MAX_MSG_SIZE>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<M: Messenger, const MAX_MSG_SIZE: usize> Display for MessageSender<M, MAX_MSG_SIZE>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<M: Messenger, const MAX_MSG_SIZE: usize> SendNonBlockingNonMut<<M as Messenger>::SendT> for MessageSender<M, MAX_MSG_SIZE>

source§

fn send_busywait_timeout( &mut self, msg: &<M as Messenger>::SendT, timeout: Duration ) -> Result<SendStatus, Error>

This implementation overrides default trait implementation by optimizing serialization of the message to only happen once in the event that the under socket is busy and returns SendStatus::WouldBlock

source§

fn send_busywait(&mut self, msg: &<M as Messenger>::SendT) -> Result<(), Error>

This implementation overrides default trait implementation by optimizing serialization of the message to only happen once in the event that the under socket is busy and returns SendStatus::WouldBlock

source§

fn send(&mut self, msg: &<M as Messenger>::SendT) -> Result<SendStatus, Error>

The call will internally serialize the msg and attempt to write the resulting bytes into a stream. If there was a successfull attempt which wrote some bytes from serialized message into the stream but the write was only partial then the call will busy wait until all of remaining bytes were 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

Auto Trait Implementations§

§

impl<M, const MAX_MSG_SIZE: usize> RefUnwindSafe for MessageSender<M, MAX_MSG_SIZE>
where M: RefUnwindSafe,

§

impl<M, const MAX_MSG_SIZE: usize> Send for MessageSender<M, MAX_MSG_SIZE>

§

impl<M, const MAX_MSG_SIZE: usize> Sync for MessageSender<M, MAX_MSG_SIZE>

§

impl<M, const MAX_MSG_SIZE: usize> Unpin for MessageSender<M, MAX_MSG_SIZE>
where M: Unpin,

§

impl<M, const MAX_MSG_SIZE: usize> UnwindSafe for MessageSender<M, MAX_MSG_SIZE>
where M: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.