[][src]Struct bb8::Pool

pub struct Pool<M> where
    M: ManageConnection
{ /* fields omitted */ }

A generic connection pool.

Methods

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

pub fn builder() -> Builder<M>[src]

Returns a Builder instance to configure a new pool.

pub fn state(&self) -> State[src]

Returns information about the current state of the pool.

pub async fn run<'a, '_, T, E, U, F>(&'_ self, f: F) -> Result<T, RunError<E>> where
    F: FnOnce(M::Connection) -> U + Send + 'a,
    U: Future<Output = Result<(T, M::Connection), (E, M::Connection)>> + Send + 'a,
    E: From<M::Error> + Send + 'a,
    T: Send + 'a, 
[src]

Run a closure with a Connection.

pub async fn get<'_, '_>(
    &'_ self
) -> Result<PooledConnection<'_, M>, RunError<M::Error>>
[src]

Retrieves a connection from the pool.

pub async fn dedicated_connection<'_>(
    &'_ self
) -> Result<M::Connection, M::Error>
[src]

Get a new dedicated connection that will not be managed by the pool. An application may want a persistent connection (e.g. to do a postgres LISTEN) that will not be closed or repurposed by the pool.

This method allows reusing the manager's configuration but otherwise bypassing the pool

Trait Implementations

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

impl<M> Debug for Pool<M> where
    M: ManageConnection
[src]

Auto Trait Implementations

impl<M> !RefUnwindSafe for Pool<M>

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

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

impl<M> Unpin for Pool<M>

impl<M> !UnwindSafe for Pool<M>

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.