pub struct PooledConnection<M>where
    M: ManageConnection,{ /* private fields */ }
Expand description

A smart pointer wrapping a connection.

Implementations§

source§

impl<M> PooledConnection<M>where M: ManageConnection,

source

pub fn extensions(this: &PooledConnection<M>) -> &Extensions

Returns a shared reference to the extensions associated with this connection.

source

pub fn extensions_mut(this: &mut PooledConnection<M>) -> &mut Extensions

Returns a mutable reference to the extensions associated with this connection.

Trait Implementations§

source§

impl<M> Connection for PooledConnection<M>where M: ManageConnection, M::Connection: Connection + R2D2Connection + Send + 'static,

§

type Backend = <<M as ManageConnection>::Connection as Connection>::Backend

The backend this type connects to
source§

fn establish(_: &str) -> ConnectionResult<Self>

Establishes a new connection to the database Read more
source§

fn begin_test_transaction(&mut self) -> QueryResult<()>

Creates a transaction that will never be committed. This is useful for tests. Panics if called while inside of a transaction or if called with a connection containing a broken transaction
source§

fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>where F: FnOnce(&mut Self) -> Result<T, E>, E: From<Error>,

Executes the given function inside of a database transaction Read more
source§

fn test_transaction<T, E, F>(&mut self, f: F) -> Twhere F: FnOnce(&mut Self) -> Result<T, E>, E: Debug,

Executes the given function inside a transaction, but does not commit it. Panics if the given function returns an error. Read more
source§

impl<M> Debug for PooledConnection<M>where M: ManageConnection, <M as ManageConnection>::Connection: Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<M> Deref for PooledConnection<M>where M: ManageConnection,

§

type Target = <M as ManageConnection>::Connection

The resulting type after dereferencing.
source§

fn deref(&self) -> &<M as ManageConnection>::Connection

Dereferences the value.
source§

impl<M> DerefMut for PooledConnection<M>where M: ManageConnection,

source§

fn deref_mut(&mut self) -> &mut <M as ManageConnection>::Connection

Mutably dereferences the value.
source§

impl<M> Drop for PooledConnection<M>where M: ManageConnection,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<B, M> LoadConnection<B> for PooledConnection<M>where M: ManageConnection, M::Connection: LoadConnection<B> + R2D2Connection,

§

type Cursor<'conn, 'query> = <<M as ManageConnection>::Connection as LoadConnection<B>>::Cursor<'conn, 'query>

The cursor type returned by LoadConnection::load Read more
§

type Row<'conn, 'query> = <<M as ManageConnection>::Connection as LoadConnection<B>>::Row<'conn, 'query>

The row type used as Iterator::Item for the iterator implementation of LoadConnection::Cursor
source§

impl<M> MigrationConnection for PooledConnection<M>where M: ManageConnection, M::Connection: MigrationConnection, Self: Connection,

source§

fn setup(&mut self) -> QueryResult<usize>

Setup the following table: Read more
source§

impl<M> SimpleConnection for PooledConnection<M>where M: ManageConnection, M::Connection: R2D2Connection + Send + 'static,

source§

fn batch_execute(&mut self, query: &str) -> QueryResult<()>

Execute multiple SQL statements within the same string. Read more
source§

impl<Changes, Output, M> UpdateAndFetchResults<Changes, Output> for PooledConnection<M>where M: ManageConnection, M::Connection: UpdateAndFetchResults<Changes, Output>, Self: Connection,

source§

fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>

See the traits documentation.

Auto Trait Implementations§

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<C> BoxableConnection<<C as Connection>::Backend> for Cwhere C: Connection + Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> IntoSql for T

source§

fn into_sql<T>(self) -> AsExprOf<Self, T>where Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.