Struct l337::Conn

source ·
pub struct Conn<C>where
    C: ManageConnection,
    C::Connection: Send,{
    pub conn: Option<Live<C::Connection>>,
    pub pool: Option<Pool<C>>,
    /* private fields */
}
Expand description

A smart wrapper around a connection which stores it back in the pool when it is dropped.

This can be dereferences to the Service instance this pool manages, and also implements Service itself by delegating.

Fields§

§conn: Option<Live<C::Connection>>

Actual connection. This should never become a None variant under normal operation. This is an option so we can take the connection on drop, and push it back into the pool

§pool: Option<Pool<C>>

Underlying pool. A reference is stored here so we can push the connection back into the pool on drop. This should never become a None variant under normal operation. This is an option so we can take the connection on drop, and push it back into the pool

Trait Implementations§

source§

impl<C> Deref for Conn<C>where C: ManageConnection, C::Connection: Send,

§

type Target = <C as ManageConnection>::Connection

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<C> DerefMut for Conn<C>where C: ManageConnection, C::Connection: Send,

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<C> Drop for Conn<C>where C: ManageConnection, C::Connection: Send,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for Conn<C>

§

impl<C> Send for Conn<C>

§

impl<C> Sync for Conn<C>where <C as ManageConnection>::Connection: Sync,

§

impl<C> Unpin for Conn<C>where <C as ManageConnection>::Connection: Unpin,

§

impl<C> !UnwindSafe for Conn<C>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more