Struct gotham::middleware::state::StateMiddleware
source · [−]pub struct StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync, { /* private fields */ }
Expand description
Middleware binding for generic types to enable easy shared state.
This acts as nothing more than a Middleware
instance which will
attach a generic type to a request State
, however it removes a
barrier for users to Gotham who might not know the internals.
The generic types inside this struct can (and will) be cloned often, so wrap your expensive types in reference counts as needed.
Implementations
sourceimpl<T> StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
impl<T> StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
Main implementation.
Trait Implementations
sourceimpl<T: Clone> Clone for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
impl<T: Clone> Clone for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
sourcefn clone(&self) -> StateMiddleware<T>
fn clone(&self) -> StateMiddleware<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Middleware for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
impl<T> Middleware for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
Middleware
trait implementation.
sourceimpl<T> NewMiddleware for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
impl<T> NewMiddleware for StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync,
NewMiddleware
trait implementation.
sourcefn new_middleware(&self) -> Result<Self::Instance>
fn new_middleware(&self) -> Result<Self::Instance>
Clones the current middleware to a new instance.
type Instance = Self
type Instance = Self
The type of Middleware
created by the NewMiddleware
.
Auto Trait Implementations
impl<T> RefUnwindSafe for StateMiddleware<T>
impl<T> Send for StateMiddleware<T>
impl<T> Sync for StateMiddleware<T>
impl<T> Unpin for StateMiddleware<T> where
T: Unpin,
impl<T> UnwindSafe for StateMiddleware<T> where
T: UnwindSafe,
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>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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