[−][src]Struct mobc::Pool
A generic connection pool.
Methods
impl<M> Pool<M> where
M: ConnectionManager,
[src]
M: ConnectionManager,
pub async fn new(manager: M) -> Result<Pool<M>, Error<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 async fn get<'_>(&'_ self) -> Result<PooledConnection<M>, Error<M::Error>>
[src]
Retrieves a connection from the pool.
Waits for at most the configured connection timeout before returning an error.
pub async fn get_timeout<'_>(
&'_ self,
dur: Duration
) -> Result<PooledConnection<M>, Error<M::Error>>
[src]
&'_ self,
dur: Duration
) -> Result<PooledConnection<M>, Error<M::Error>>
Retrieves a connection from the pool, waiting for at most timeout
The given timeout will be used instead of the configured connection timeout.
pub async 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 async fn state<'_>(&'_ self) -> State
[src]
Returns information about the current state of the pool.
Trait Implementations
impl<M> Clone for Pool<M> where
M: ConnectionManager,
[src]
M: ConnectionManager,
Returns a new Pool
referencing the same state as self
.
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<M> Send for Pool<M> where
<M as ConnectionManager>::Connection: Send,
<M as ConnectionManager>::Error: Send,
<M as ConnectionManager>::Executor: Send + Sync,
<M as ConnectionManager>::Connection: Send,
<M as ConnectionManager>::Error: Send,
<M as ConnectionManager>::Executor: Send + Sync,
impl<M> Sync for Pool<M> where
<M as ConnectionManager>::Connection: Send,
<M as ConnectionManager>::Error: Send,
<M as ConnectionManager>::Executor: Send + Sync,
<M as ConnectionManager>::Connection: Send,
<M as ConnectionManager>::Error: Send,
<M as ConnectionManager>::Executor: Send + Sync,
impl<M> Unpin for Pool<M>
impl<M> !UnwindSafe for Pool<M>
impl<M> !RefUnwindSafe for Pool<M>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,