pub struct Depot { /* private fields */ }
Expand description
Depot if for store temp data of current request. Each handler can read or write data to it.
Implementations
sourceimpl Depot
impl Depot
sourcepub fn new() -> Depot
pub fn new() -> Depot
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.
sourcepub fn with_capacity(capacity: usize) -> Depot
pub fn with_capacity(capacity: usize) -> Depot
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.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the depot can hold without reallocating.
sourcepub fn insert<K, V>(&mut self, key: K, value: V) where
K: Into<String>,
V: Any + Send + Sync,
pub fn insert<K, V>(&mut self, key: K, value: V) where
K: Into<String>,
V: Any + Send + Sync,
Inserts a key-value pair into the depot.
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check is there a value stored in depot with this key.
sourcepub fn get<V>(&self, key: &str) -> Option<&V> where
V: Any + Send,
pub fn get<V>(&self, key: &str) -> Option<&V> where
V: Any + Send,
Immutably borrows value from depot, returing none if value is not present in depot.
sourcepub fn get_mut<V>(&mut self, key: &str) -> Option<&mut V> where
V: Any + Send,
pub fn get_mut<V>(&mut self, key: &str) -> Option<&mut V> where
V: Any + Send,
Mutably borrows value from depot, returing none if value is not present in depot.
Trait Implementations
sourceimpl BasicAuthDepotExt for Depot
impl BasicAuthDepotExt for Depot
sourcefn basic_auth_username(&self) -> Option<&String>
fn basic_auth_username(&self) -> Option<&String>
Get basic auth username reference.
sourceimpl CsrfDepotExt for Depot
impl CsrfDepotExt for Depot
sourcefn csrf_token(&self) -> Option<&str>
fn csrf_token(&self) -> Option<&str>
Gets the CSRF token for inclusion in an HTTP request header, a query parameter, or a form field. Read more
sourcefn csrf_header_name(&self) -> Option<&str>
fn csrf_header_name(&self) -> Option<&str>
Gets the name of the header in which to returns the CSRF token, if the CSRF token is being returned in a header. Read more
sourcefn csrf_query_param(&self) -> Option<&str>
fn csrf_query_param(&self) -> Option<&str>
Gets the name of the query param in which to returns the CSRF token, if the CSRF token is being returned in a query param. Read more
sourcefn csrf_field_name(&self) -> Option<&str>
fn csrf_field_name(&self) -> Option<&str>
Gets the name of the form field in which to returns the CSRF token, if the CSRF token is being returned in a form field. Read more
sourceimpl JwtAuthDepotExt for Depot
impl JwtAuthDepotExt for Depot
sourcefn jwt_auth_token(&self) -> Option<&String>
fn jwt_auth_token(&self) -> Option<&String>
get jwt auth token reference from depot.
sourcefn jwt_auth_data<C>(&self) -> Option<&TokenData<C>> where
C: 'static + DeserializeOwned + Sync + Send,
fn jwt_auth_data<C>(&self) -> Option<&TokenData<C>> where
C: 'static + DeserializeOwned + Sync + Send,
get jwt auth decoded data from depot.
sourcefn jwt_auth_state(&self) -> JwtAuthState
fn jwt_auth_state(&self) -> JwtAuthState
get jwt auth state from depot.
sourceimpl SessionDepotExt for Depot
impl SessionDepotExt for Depot
sourcefn set_session(&mut self, session: Session)
fn set_session(&mut self, session: Session)
Set session
sourcefn take_session(&mut self) -> Option<Session>
fn take_session(&mut self) -> Option<Session>
Take session
sourcefn session_mut(&mut self) -> Option<&mut Session>
fn session_mut(&mut self) -> Option<&mut Session>
Get session mutable reference
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more