pub struct Client<M: Connector> { /* private fields */ }
Expand description
Generic connection and connection pool.
This struct can be cloned and transferred across thread boundaries and uses reference counting for its internal state.
Implementations§
Source§impl<M: Connector> Client<M>
impl<M: Connector> Client<M>
Sourcepub fn builder(connector: M) -> ClientBuilder<M>
pub fn builder(connector: M) -> ClientBuilder<M>
Sourcepub async fn get(
&self,
key: M::Key,
) -> Result<PooledConnection<M>, ClientError<M::Error>>
pub async fn get( &self, key: M::Key, ) -> Result<PooledConnection<M>, ClientError<M::Error>>
Retrieves an PooledConnection
from this Client
or waits for one to
become available.
§Errors
See ClientError
for details.
Sourcepub async fn timeout_get(
&self,
key: M::Key,
timeouts: &Timeouts,
) -> Result<PooledConnection<M>, ClientError<M::Error>>
pub async fn timeout_get( &self, key: M::Key, timeouts: &Timeouts, ) -> Result<PooledConnection<M>, ClientError<M::Error>>
Retrieves an PooledConnection
from this Client
using a different timeout
than the configured one.
§Errors
See ClientError
for details.
Sourcepub fn close(&self)
pub fn close(&self)
Closes this Client
.
All current and future tasks waiting for PooledConnection
s will return
ClientError::Closed
immediately.
This operation resizes the pool to 0.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for Client<M>
impl<M> !RefUnwindSafe for Client<M>
impl<M> !Send for Client<M>
impl<M> !Sync for Client<M>
impl<M> Unpin for Client<M>
impl<M> !UnwindSafe for Client<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more