[][src]Struct kf_socket::SocketPool

pub struct SocketPool<T> where
    T: Eq + Hash
{ /* fields omitted */ }

pooling of sockets

Methods

impl<T> SocketPool<T> where
    T: Eq + PartialEq + Hash + Debug + Clone,
    KfSocket: Sync
[src]

pub fn new() -> Self[src]

pub fn insert_socket(&self, id: T, socket: KfSocket)[src]

pub fn get_socket(&self, id: &T) -> Option<WriteGuard<T, KfSocket>>[src]

get valid client. return only client which is not stale

impl<T> SocketPool<T> where
    T: Eq + PartialEq + Hash + Debug + Clone + ToSocketAddrs,
    KfSocket: Sync
[src]

pub async fn make_connection<'_>(&'_ self, id: T) -> Result<(), KfSocketError>[src]

make connection where id can be used as address

impl<T> SocketPool<T> where
    T: Eq + PartialEq + Hash + Debug + Clone,
    KfSocket: Sync
[src]

pub async fn make_connection_with_addr<'a, A>(
    &'a self,
    id: T,
    addr: &'a A
) -> Result<(), KfSocketError> where
    A: ToSocketAddrs + Debug
[src]

make connection with addres as separate parameter

pub async fn get_or_make<'a, A>(
    &'a self,
    id: T,
    addr: &'a A
) -> Result<Option<WriteGuard<'a, T, KfSocket>>, KfSocketError> where
    A: ToSocketAddrs + Debug
[src]

get existing socket connection or make new one

Trait Implementations

impl<T: Debug> Debug for SocketPool<T> where
    T: Eq + Hash
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SocketPool<T>

impl<T> Send for SocketPool<T> where
    T: Send

impl<T> Sync for SocketPool<T> where
    T: Send + Sync

impl<T> Unpin for SocketPool<T> where
    T: Unpin

impl<T> !UnwindSafe for SocketPool<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.