[][src]Struct diesel::r2d2::Pool

pub struct Pool<M>(_)
where
    M: ManageConnection
;

A generic connection pool.

Methods

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

pub fn new(manager: M) -> Result<Pool<M>, Error>[src]

Creates a new connection pool with a default configuration.

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

Returns a builder type to configure a new pool.

pub fn get(&self) -> Result<PooledConnection<M>, Error>[src]

Retrieves a connection from the pool.

Waits for at most the configured connection timeout before returning an error.

pub fn get_timeout(
    &self,
    timeout: Duration
) -> Result<PooledConnection<M>, Error>
[src]

Retrieves a connection from the pool, waiting for at most timeout

The given timeout will be used instead of the configured connection timeout.

pub fn try_get(&self) -> Option<PooledConnection<M>>[src]

Attempts to retrieve a connection from the pool if there is one available.

Returns None if there are no idle connections available in the pool. This method will not block waiting to establish a new connection.

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

Returns information about the current state of the pool.

pub fn max_size(&self) -> u32[src]

Returns the configured maximum pool size.

pub fn min_idle(&self) -> Option<u32>[src]

Returns the configured mimimum idle connection count.

pub fn test_on_check_out(&self) -> bool[src]

Returns if the pool is configured to test connections on check out.

pub fn max_lifetime(&self) -> Option<Duration>[src]

Returns the configured maximum connection lifetime.

pub fn idle_timeout(&self) -> Option<Duration>[src]

Returns the configured idle connection timeout.

pub fn connection_timeout(&self) -> Duration[src]

Returns the configured connection timeout.

Trait Implementations

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

Returns a new Pool referencing the same state as self.

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

Auto Trait Implementations

impl<M> Unpin for Pool<M>

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

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

impl<M> !UnwindSafe for Pool<M>

impl<M> !RefUnwindSafe for Pool<M>

Blanket Implementations

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> AsExprOf<Self, T> where
    Self: AsExpression<T> + Sized
[src]

Convert self to an expression for Diesel's query builder. Read more

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T> where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel's query builder. Read more

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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