pub struct Extensions { /* private fields */ }Expand description
A type map of request extensions.
Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn new() -> Extensions
pub fn new() -> Extensions
Creates an empty Extensions map.
Sourcepub fn insert<T: 'static>(&mut self, val: T) -> Option<T>
pub fn insert<T: 'static>(&mut self, val: T) -> Option<T>
Insert a type into this Extensions.
Returns the previous value of the same type, if present.
Sourcepub fn get<T: 'static>(&self) -> Option<&T>
pub fn get<T: 'static>(&self) -> Option<&T>
Returns a reference to a previously inserted value of type T.
Sourcepub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
Returns a mutable reference to a previously inserted value of type T.
Sourcepub fn remove<T: 'static>(&mut self) -> Option<T>
pub fn remove<T: 'static>(&mut self) -> Option<T>
Remove a type from this Extensions.
Returns the removed value, if present.
Sourcepub fn extend(&mut self, other: Extensions)
pub fn extend(&mut self, other: Extensions)
Moves all values from other into this map.
Trait Implementations§
Source§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 !RefUnwindSafe for Extensions
impl !Send for Extensions
impl !Sync for Extensions
impl !UnwindSafe for Extensions
impl Freeze for Extensions
impl Unpin for Extensions
impl UnsafeUnpin 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