[−][src]Struct kf_socket::SocketPool
pooling of sockets
Methods
impl<T> SocketPool<T> where
T: Eq + PartialEq + Hash + Debug + Clone,
KfSocket: Sync,
[src]
T: Eq + PartialEq + Hash + Debug + Clone,
KfSocket: Sync,
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]
T: Eq + PartialEq + Hash + Debug + Clone + ToSocketAddrs,
KfSocket: Sync,
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]
T: Eq + PartialEq + Hash + Debug + Clone,
KfSocket: Sync,
pub async fn make_connection_with_addr<'a, A>(
&'a self,
id: T,
addr: &'a A
) -> Result<(), KfSocketError> where
A: ToSocketAddrs + Debug,
[src]
&'a self,
id: T,
addr: &'a A
) -> Result<(), KfSocketError> where
A: ToSocketAddrs + Debug,
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]
&'a self,
id: T,
addr: &'a A
) -> Result<Option<WriteGuard<'a, T, KfSocket>>, KfSocketError> where
A: ToSocketAddrs + Debug,
get existing socket connection or make new one
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for SocketPool<T>
impl<T> Send for SocketPool<T> where
T: Send,
T: Send,
impl<T> Sync for SocketPool<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for SocketPool<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for SocketPool<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,