Struct salvo::Depot [−][src]
pub struct Depot { /* fields omitted */ }
Expand description
Depot if for store temp data of current request. Each handler can read or write data to it.
Implementations
impl Depot
[src]
impl Depot
[src]pub fn new() -> Depot
[src]
pub fn new() -> Depot
[src]Creates an empty Depot
.
The depot is initially created with a capacity of 0, so it will not allocate until it is first inserted into.
pub fn with_capacity(capacity: usize) -> Depot
[src]
pub fn with_capacity(capacity: usize) -> Depot
[src]Creates an empty Depot
with the specified capacity.
The depot will be able to hold at least capacity elements without reallocating. If capacity is 0, the depot will not allocate.
pub fn insert<K, V>(&mut self, key: K, value: V) where
V: Any + Send,
K: Into<String>,
[src]
pub fn insert<K, V>(&mut self, key: K, value: V) where
V: Any + Send,
K: Into<String>,
[src]Inserts a key-value pair into the depot.
pub fn has<K>(&self, key: K) -> bool where
K: Into<String>,
[src]
pub fn has<K>(&self, key: K) -> bool where
K: Into<String>,
[src]Check is there a value stored in depot with this key.
pub fn try_borrow<K, V>(&self, key: K) -> Option<&V> where
V: Any + Send,
K: Into<String>,
[src]
pub fn try_borrow<K, V>(&self, key: K) -> Option<&V> where
V: Any + Send,
K: Into<String>,
[src]Immutably borrows value from depot, returing none if value is not present in depot.
pub fn borrow<K, V>(&self, key: K) -> &V where
V: Any + Send,
K: Into<String>,
[src]
pub fn borrow<K, V>(&self, key: K) -> &V where
V: Any + Send,
K: Into<String>,
[src]Immutably borrows value from depot.
Panics
Panics if the value is currently mutably borrowed or not present in depot. For a non-panicking variant, use
try_borrow
.
pub fn try_borrow_mut<K, V>(&mut self, key: K) -> Option<&mut V> where
V: Any + Send,
K: Into<String>,
[src]
pub fn try_borrow_mut<K, V>(&mut self, key: K) -> Option<&mut V> where
V: Any + Send,
K: Into<String>,
[src]Mutably borrows value from depot, returing none if value is not present in depot.
pub fn borrow_mut<K, V>(&mut self, key: K) -> &mut V where
V: Any + Send,
K: Into<String>,
[src]
pub fn borrow_mut<K, V>(&mut self, key: K) -> &mut V where
V: Any + Send,
K: Into<String>,
[src]Mutably borrows value from depot.
Panics
Panics if the value is currently borrowed or not present in depot. For a non-panicking variant, use
try_borrow_mut
.
pub fn try_take<K, V>(&mut self, key: K) -> Option<V> where
V: Any + Send,
K: Into<String>,
[src]
pub fn try_take<K, V>(&mut self, key: K) -> Option<V> where
V: Any + Send,
K: Into<String>,
[src]Take value from depot container.
pub fn transfer(&mut self) -> Depot
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Depot
impl Send for Depot
impl !Sync for Depot
impl Unpin for Depot
impl !UnwindSafe for Depot
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,