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 moresourceimpl<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 = StateMiddleware<T>
type Instance = StateMiddleware<T>
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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