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§
source§impl<T> StateMiddleware<T>where
T: Clone + RefUnwindSafe + StateData + Sync,
impl<T> StateMiddleware<T>where
T: Clone + RefUnwindSafe + StateData + Sync,
Main implementation.
Trait Implementations§
source§impl<T> Clone for StateMiddleware<T>where
T: Clone + RefUnwindSafe + StateData + Sync + Clone,
impl<T> Clone for StateMiddleware<T>where
T: Clone + RefUnwindSafe + StateData + Sync + Clone,
source§fn clone(&self) -> StateMiddleware<T>
fn clone(&self) -> StateMiddleware<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<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.
source§impl<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.
source§fn 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
.