Struct diesel::r2d2::Extensions
source · [−]pub struct Extensions(_);
Expand description
A “type map” used to associate data with pooled connections.
Extensions
is a data structure mapping types to a value of that type. This
can be used to, for example, cache prepared statements along side their
connection.
Implementations
sourceimpl Extensions
impl Extensions
sourcepub fn new() -> Extensions
pub fn new() -> Extensions
Returns a new, empty Extensions
.
sourcepub fn insert<T>(&mut self, value: T) -> Option<T>where
T: 'static + Sync + Send,
pub fn insert<T>(&mut self, value: T) -> Option<T>where
T: 'static + Sync + Send,
Inserts a new value into the map.
Returns the previously stored value of that type, if present.
sourcepub fn get<T>(&self) -> Option<&T>where
T: 'static + Sync + Send,
pub fn get<T>(&self) -> Option<&T>where
T: 'static + Sync + Send,
Returns a shared reference to the stored value of the specified type.
sourcepub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: 'static + Sync + Send,
pub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: 'static + Sync + Send,
Returns a mutable reference to the stored value of the specified type.
Trait Implementations
sourceimpl Default for Extensions
impl Default for Extensions
sourcefn default() -> Extensions
fn default() -> Extensions
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl !UnwindSafe for Extensions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> AsExprOf<Self, T>where
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
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 moresourcefn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>where
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
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