pub struct Extensions(/* private fields */);
Available on crate feature
r2d2
only.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§
Source§impl 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>
pub fn insert<T>(&mut self, value: T) -> Option<T>
Inserts a new value into the map.
Returns the previously stored value of that type, if present.
Sourcepub fn get<T>(&self) -> Option<&T>
pub fn get<T>(&self) -> Option<&T>
Returns a shared reference to the stored value of the specified type.
Sourcepub fn get_mut<T>(&mut self) -> Option<&mut T>
pub fn get_mut<T>(&mut self) -> Option<&mut T>
Returns a mutable reference to the stored value of the specified type.
Trait Implementations§
Source§impl Default for Extensions
impl Default for Extensions
Source§fn default() -> Extensions
fn default() -> Extensions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Extensions
impl !RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl !UnwindSafe for Extensions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more