Struct l337::Pool [−][src]
pub struct Pool<C: ManageConnection + Send> { /* fields omitted */ }
Expand description
General connection pool
Implementations
impl<C: ManageConnection> Pool<C>
[src]
impl<C: ManageConnection> Pool<C>
[src]impl<C: ManageConnection + Send> Pool<C>
[src]
impl<C: ManageConnection + Send> Pool<C>
[src]pub async fn new(manager: C, config: Config) -> Result<Pool<C>, Error<C::Error>>
[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]
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]
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]
pub fn total_conns(&self) -> usize
[src]The total number of connections in the pool.
pub fn idle_conns(&self) -> usize
[src]
pub fn idle_conns(&self) -> usize
[src]The number of idle connections in the pool.
pub fn idle_conns_push_error(&self) -> usize
[src]
pub fn idle_conns_push_error(&self) -> usize
[src]The number of errors when the connection push back to the pool.
Trait Implementations
impl<C> Clone for Pool<C> where
C: ManageConnection,
[src]
impl<C> Clone for Pool<C> where
C: ManageConnection,
[src]Returns a new Pool
referencing the same state as self
.
Auto Trait Implementations
impl<C> !RefUnwindSafe for Pool<C>
impl<C> Send for Pool<C>
impl<C> Sync for Pool<C>
impl<C> Unpin for Pool<C>
impl<C> !UnwindSafe for Pool<C>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more