[−][src]Struct l337::Pool
General connection pool
Methods
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.
This does not implement any timeout functionality. Timeout functionality can be added
by calling .timeout
on the returned future.
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.
Trait Implementations
impl<C> Clone for Pool<C> where
C: ManageConnection,
[src]
C: ManageConnection,
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,
<C as ManageConnection>::Connection: Send,
impl<C> Sync for Pool<C> where
<C as ManageConnection>::Connection: Send,
<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]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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 = Infallible
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>,