monoio_client::client

Struct Client

Source
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>

Source

pub fn builder(connector: M) -> ClientBuilder<M>

Instantiates a builder for a new Client.

This is the only way to create a Client instance.

Source

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.

Source

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.

Source

pub fn timeouts(&self) -> Timeouts

Get current timeout configuration

Source

pub fn close(&self)

Closes this Client.

All current and future tasks waiting for PooledConnections will return ClientError::Closed immediately.

This operation resizes the pool to 0.

Source

pub fn is_closed(&self) -> bool

Indicates whether this Client has been closed.

Source

pub fn status(&self) -> Status

Retrieves Status of this Client.

Source

pub fn connector(&self) -> &M

Returns Connector of this Client.

Trait Implementations§

Source§

impl<M: Connector> Clone for Client<M>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M> Debug for Client<M>
where M: Debug + Connector, M::Connection: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.