Skip to main content

Lease

Struct Lease 

Source
pub struct Lease<C: Pooled> { /* private fields */ }
Expand description

A checked-out connection, or a reserved place for a fresh one. Dropped without ConnectionPool::release, it closes and frees its place.

Implementations§

Source§

impl<C: Pooled> Lease<C>

Source

pub fn conn(&self) -> Option<&C>

The connection, once there is one.

Source

pub fn is_reused(&self) -> bool

Source

pub fn conn_mut(&mut self) -> Option<&mut C>

Source

pub fn fill(&mut self, conn: C)

Put the fresh connection in the reserved place.

Source

pub fn observation(&self, key_digest: &str) -> Option<ConnectionObservation>

What evidence states about the connection, before release.

Trait Implementations§

Source§

impl<C: Pooled> Drop for Lease<C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Lease<C>

§

impl<C> RefUnwindSafe for Lease<C>

§

impl<C> Send for Lease<C>
where Arc<ConnectionPool<C>>: Send, Option<C>: Send,

§

impl<C> Sync for Lease<C>
where Arc<ConnectionPool<C>>: Sync, Option<C>: Sync,

§

impl<C> Unpin for Lease<C>

§

impl<C> UnsafeUnpin for Lease<C>

§

impl<C> UnwindSafe for Lease<C>

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.