pub struct Extensions { /* private fields */ }Expand description
Per-request type-indexed storage shared across middleware hooks and handlers.
Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn insert<T>(&self, value: T) -> Option<T>
pub fn insert<T>(&self, value: T) -> Option<T>
Insert a typed value into the bag, returning the previous value of the same type.
Sourcepub fn with<T, R>(&self, f: impl FnOnce(&T) -> R) -> Option<R>
pub fn with<T, R>(&self, f: impl FnOnce(&T) -> R) -> Option<R>
Borrow a typed value from the bag for the duration of f.
Trait Implementations§
Source§impl Clone for Extensions
impl Clone for Extensions
Source§fn clone(&self) -> Extensions
fn clone(&self) -> Extensions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Extensions
impl Debug for Extensions
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 UnsafeUnpin 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