Skip to main content

PoolCltAcceptor

Struct PoolCltAcceptor 

Source
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>

Source

pub fn new( tx_recver: Sender<CltRecver<M, C, MAX_MSG_SIZE>>, tx_sender: Sender<CltSender<M, C, MAX_MSG_SIZE>>, acceptor: SvcAcceptor<M, C, MAX_MSG_SIZE>, ) -> Self

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>

Source§

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

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

impl<M: Messenger, C: CallbackRecvSend<M>, const MAX_MSG_SIZE: usize> Display for PoolCltAcceptor<M, C, MAX_MSG_SIZE>

Source§

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

Formats the value using the given formatter. Read more
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>

Source§

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>

§

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>

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§

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>,

Source§

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>,

Source§

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.