pub struct PoolCltAcceptor<M: Messenger + 'static, C: CallbackRecvSend<M> + 'static, const MAX_MSG_SIZE: usize> { /* private fields */ }Expand description
Abstraction used to accept new connections bound to the address and transmit them via a channel to the respective CltSendersPool & CltRecversPool.
It is designed to be used in a thread which is different from the thread that will be using the CltSendersPool & CltRecversPool.
§Example
use links_blocking::prelude::*;
use links_core::unittest::setup::framer::{CltTestMessenger, SvcTestMessenger, TEST_MSG_FRAME_SIZE};
let addr = "127.0.0.1:8080";
let acceptor = SvcAcceptor::<_,_, TEST_MSG_FRAME_SIZE>::new(
ConId::svc(Some("doctest"), addr, None),
std::net::TcpListener::bind(addr).unwrap(),
DevNullCallback::<SvcTestMessenger>::default().into(),
);
let (tx_recver, rx_recver) = std::sync::mpsc::channel();
let (tx_sender, rx_sender) = std::sync::mpsc::channel();
let mut pool = PoolCltAcceptor::new(tx_recver, tx_sender, acceptor);
println!("pool: {}", pool);
pool.pool_accept().unwrap();
Implementations§
Source§impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> PoolCltAcceptor<M, C, MAX_MSG_SIZE>
Trait Implementations§
Source§impl<M: Debug + Messenger + 'static, C: Debug + CallbackRecvSend<M> + 'static, const MAX_MSG_SIZE: usize> Debug for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M: Debug + Messenger + 'static, C: Debug + CallbackRecvSend<M> + 'static, const MAX_MSG_SIZE: usize> Debug for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
Source§impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> Display for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> Display for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
Source§impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> PoolAcceptClt<M, C, MAX_MSG_SIZE> for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> PoolAcceptClt<M, C, MAX_MSG_SIZE> for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
Source§fn pool_accept(&mut self) -> Result<(), Error>
fn pool_accept(&mut self) -> Result<(), Error>
Will interrogate the SvcAcceptor for new connections and if available will send them to the respective CltRecver & CltSender pools.
Auto Trait Implementations§
impl<M, C, const MAX_MSG_SIZE: usize> Freeze for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M, C, const MAX_MSG_SIZE: usize> RefUnwindSafe for PoolCltAcceptor<M, C, MAX_MSG_SIZE>where
M: RefUnwindSafe,
C: RefUnwindSafe,
impl<M, C, const MAX_MSG_SIZE: usize> Send for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M, C, const MAX_MSG_SIZE: usize> Sync for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M, C, const MAX_MSG_SIZE: usize> Unpin for PoolCltAcceptor<M, C, MAX_MSG_SIZE>where
M: Unpin,
impl<M, C, const MAX_MSG_SIZE: usize> UnsafeUnpin for PoolCltAcceptor<M, C, MAX_MSG_SIZE>
impl<M, C, const MAX_MSG_SIZE: usize> UnwindSafe for PoolCltAcceptor<M, C, MAX_MSG_SIZE>where
C: RefUnwindSafe,
M: UnwindSafe,
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