Struct links_nonblocking::connect::clt::CltRecver
source · 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>
impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> CltRecver<P, C, MAX_MSG_SIZE>
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>
impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> ConnectionId for CltRecver<P, C, MAX_MSG_SIZE>
source§impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> ConnectionStatus for CltRecver<P, C, MAX_MSG_SIZE>
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
fn is_connected(&self) -> bool
logical check of connection status
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>
impl<P: Debug + Protocol, C: Debug + CallbackRecv<P>, const MAX_MSG_SIZE: usize> Debug for CltRecver<P, C, MAX_MSG_SIZE>
source§impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> Display for CltRecver<P, C, MAX_MSG_SIZE>
impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> Display for CltRecver<P, C, MAX_MSG_SIZE>
source§impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> From<CltRecver<P, C, MAX_MSG_SIZE>> for Box<dyn PollRead>
impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> From<CltRecver<P, C, MAX_MSG_SIZE>> for Box<dyn PollRead>
source§impl<P: Protocol, C: CallbackRecv<P>, const MAX_MSG_SIZE: usize> PollAble for CltRecver<P, C, MAX_MSG_SIZE>
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>
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§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>
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>
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>
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>
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>
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>
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>
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>
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>where
C: RefUnwindSafe,
P: RefUnwindSafe,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more