pub struct CltRecver<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> { /* private fields */ }
Expand description

An abstraction over a MessageRecver that executes crate::prelude::ProtocolCore::on_recv and CallbackRecv::on_recv callbacks on every message being processed by CltRecver. It is designed to work in a single thread that is different from CltSender thread.

§Important

This is an owned implementation and is not Cloneable or Syncable.

§Warning

Dropping CltRecver will also result in termination of the connection in the paired CltSender instance

Implementations§

source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> CltRecver<P, C, MAX_MSG_SIZE>

source

pub fn new( recver: MessageRecver<P, MAX_MSG_SIZE>, callback: Arc<C>, protocol: Arc<P>, acceptor_connection_gate: Option<RemoveConnectionBarrierOnDrop> ) -> Self

Trait Implementations§

source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> ConnectionId for CltRecver<P, C, MAX_MSG_SIZE>

source§

fn con_id(&self) -> &ConId

source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> ConnectionStatus for CltRecver<P, C, MAX_MSG_SIZE>

source§

fn is_connected(&self) -> bool

logical check of connection status
source§

fn is_connected_busywait_timeout(&self, timeout: Duration) -> bool

source§

impl<P: Debug + Protocol, C: Debug + CallbackRecv<P>, const MAX_MSG_SIZE: usize> Debug for CltRecver<P, C, MAX_MSG_SIZE>

source§

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

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

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> Display for CltRecver<P, C, MAX_MSG_SIZE>

source§

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

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

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> From<CltRecver<P, C, MAX_MSG_SIZE>> for Box<dyn PollRead>

source§

fn from(value: CltRecver<P, C, MAX_MSG_SIZE>) -> Self

Converts to this type from the input type.
source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> PollAble for CltRecver<P, C, MAX_MSG_SIZE>

source§

fn source(&mut self) -> Box<&mut dyn Source>

represents the source of the event, typically implementing this function is sufficient as PollAble::register and PollAble::deregister functions are implemented using it to get the source for the poll. However You can choose to override PollAble::register and PollAble::deregister functions when for example you require to lock a mutes to get access to the source in which case source function will not be used.
source§

fn register( &mut self, registry: &Registry, token: Token, interests: Interest ) -> Result<(), Error>

this function exists as a hook in case you need to perform resource locking prior to registering the source Read more
source§

fn deregister(&mut self, registry: &Registry) -> Result<(), Error>

this function exists as a hook in case you need to perform resource locking prior to de-registering the source Read more
source§

impl<P: Protocol, C: CallbackRecvSend<P>, const MAX_MSG_SIZE: usize> PollAccept<CltRecver<P, C, MAX_MSG_SIZE>> for TransmittingSvcAcceptor<P, C, MAX_MSG_SIZE>

source§

fn poll_accept( &mut self ) -> Result<AcceptStatus<CltRecver<P, C, MAX_MSG_SIZE>>, Error>

source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> PollRead for CltRecver<P, C, MAX_MSG_SIZE>

source§

fn on_readable_event(&mut self) -> Result<PollEventStatus, Error>

Will be called when OS signals that the source is readable
source§

impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> RecvNonBlocking<<P as Messenger>::RecvT> for CltRecver<P, C, MAX_MSG_SIZE>

source§

fn recv(&mut self) -> Result<RecvStatus<P::RecvT>, Error>

Will attempt to read a message from the stream. Each call to this method will attempt to read data from the stream via system call and if sufficient number of bytes were read to make a single frame it will attempt to deserialize it into a message and return it
source§

fn recv_busywait_timeout( &mut self, timeout: Duration ) -> Result<RecvStatus<T>, Error>

Will call Self::recv until it returns RecvStatus::Completed or RecvStatus::WouldBlock after the timeout.
source§

fn recv_busywait(&mut self) -> Result<Option<T>, Error>

Will busywait block on Self::recv until it returns RecvStatus::Completed

Auto Trait Implementations§

§

impl<P, C, const MAX_MSG_SIZE: usize> RefUnwindSafe for CltRecver<P, C, MAX_MSG_SIZE>

§

impl<P, C, const MAX_MSG_SIZE: usize> Send for CltRecver<P, C, MAX_MSG_SIZE>

§

impl<P, C, const MAX_MSG_SIZE: usize> Sync for CltRecver<P, C, MAX_MSG_SIZE>

§

impl<P, C, const MAX_MSG_SIZE: usize> Unpin for CltRecver<P, C, MAX_MSG_SIZE>
where P: Unpin,

§

impl<P, C, const MAX_MSG_SIZE: usize> UnwindSafe for CltRecver<P, C, MAX_MSG_SIZE>

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.