Struct ConnectionPool

Source
pub struct ConnectionPool<T, P, C, V>
where T: Send + 'static, P: Send + Sync + Clone + 'static, C: Send + Sync + 'static, V: Send + Sync + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<T, P, C, V> ConnectionPool<T, P, C, V>
where C: ConnectionCreator<T, P> + Send + Sync + 'static, V: ConnectionValidator<T> + Send + Sync + 'static, T: Send + 'static, P: Send + Sync + Clone + 'static,

Source

pub fn new( max_size: Option<usize>, max_idle_time: Option<Duration>, connection_timeout: Option<Duration>, cleanup_config: Option<CleanupConfig>, connection_params: P, connection_creator: C, connection_validator: V, ) -> Arc<Self>

Source

pub async fn get_connection( self: Arc<Self>, ) -> Result<PooledStream<T, P, C, V>, PoolError<C::Error>>

Source

pub async fn stop_cleanup_task(&self)

Stop the background cleanup task

Source

pub async fn restart_cleanup_task(&self, cleanup_config: CleanupConfig)

Restart the background cleanup task with new configuration

Source§

impl ConnectionPool<TcpStream, String, TcpConnectionCreator, TcpConnectionValidator>

Source

pub fn new_tcp( max_size: Option<usize>, max_idle_time: Option<Duration>, connection_timeout: Option<Duration>, cleanup_config: Option<CleanupConfig>, address: String, ) -> Arc<Self>

Auto Trait Implementations§

§

impl<T, P, C, V> Freeze for ConnectionPool<T, P, C, V>
where P: Freeze, C: Freeze, V: Freeze,

§

impl<T, P, C, V> !RefUnwindSafe for ConnectionPool<T, P, C, V>

§

impl<T, P, C, V> Send for ConnectionPool<T, P, C, V>

§

impl<T, P, C, V> Sync for ConnectionPool<T, P, C, V>

§

impl<T, P, C, V> Unpin for ConnectionPool<T, P, C, V>
where P: Unpin, C: Unpin, V: Unpin,

§

impl<T, P, C, V> !UnwindSafe for ConnectionPool<T, P, C, V>

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