[][src]Struct l337::Pool

pub struct Pool<C: ManageConnection + Send> { /* fields omitted */ }

General connection pool

Implementations

impl<C: ManageConnection> Pool<C>[src]

pub fn min_conns(&self) -> usize[src]

Minimum number of connections in the pool.

pub fn max_conns(&self) -> usize[src]

Maximum possible number of connections in the pool.

impl<C: ManageConnection + Send> Pool<C>[src]

pub async fn new(manager: C, config: Config) -> Result<Pool<C>, Error<C::Error>>[src]

Creates a new connection pool

The returned future will resolve to the pool if successful, which can then be used immediately.

pub async fn connection<'_>(&'_ self) -> Result<Conn<C>, Error<C::Error>>[src]

Returns a future that resolves to a connection from the pool.

If there are connections that are available to be used, the future will resolve immediately, otherwise, the connection will be in a pending state until a future is returned to the pool.

Timeout ability can be added to this method by calling connection_timeout on the Config.

pub fn put_back(&self, conn: Live<C::Connection>)[src]

Receive a connection back to be stored in the pool. This could have one of two outcomes:

  • The connection will be passed to a waiting future, if any exist.
  • The connection will be put back into the connection pool.

pub fn total_conns(&self) -> usize[src]

The total number of connections in the pool.

pub fn idle_conns(&self) -> usize[src]

The number of idle connections in the pool.

pub fn waiters(&self) -> usize[src]

The number of waiters for the next available connections.

Trait Implementations

impl<C> Clone for Pool<C> where
    C: ManageConnection
[src]

Returns a new Pool referencing the same state as self.

impl<C: ManageConnection + Send + Debug> Debug for Pool<C>[src]

Auto Trait Implementations

impl<C> !RefUnwindSafe for Pool<C>

impl<C> Send for Pool<C> where
    <C as ManageConnection>::Connection: Send

impl<C> Sync for Pool<C> where
    <C as ManageConnection>::Connection: Send

impl<C> Unpin for Pool<C>

impl<C> !UnwindSafe for Pool<C>

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.