[][src]Struct r2d2::Extensions

pub struct Extensions(_);

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.

Methods

impl Extensions[src]

pub fn new() -> Extensions[src]

Returns a new, empty Extensions.

pub fn insert<T>(&mut self, value: T) -> Option<T> where
    T: 'static + Sync + Send
[src]

Inserts a new value into the map.

Returns the previously stored value of that type, if present.

pub fn get<T>(&self) -> Option<&T> where
    T: 'static + Sync + Send
[src]

Returns a shared reference to the stored value of the specified type.

pub fn get_mut<T>(&mut self) -> Option<&mut T> where
    T: 'static + Sync + Send
[src]

Returns a mutable reference to the stored value of the specified type.

pub fn remove<T>(&mut self) -> Option<T> where
    T: 'static + Sync + Send
[src]

Removes the value of the specified type from the map, returning it.

pub fn clear(&mut self)[src]

Removes all values from the map.

Trait Implementations

impl Default for Extensions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.