Struct gotham::middleware::state::StateMiddleware [−][src]
pub struct StateMiddleware<T> where
T: Clone + RefUnwindSafe + StateData + Sync, { /* fields omitted */ }
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
Main implementation.
Trait Implementations
Middleware
trait implementation.
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.
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
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more