pub struct MiddlewareChain<T>where
T: 'static,{
pub chain: Chain<T>,
pub assigned: bool,
}
Expand description
The MiddlewareChain is used to wrap a series of middleware functions in such a way that the tail can be accessed and modified later on. This allows Thruster to properly compose pieces of middleware into a single long chain rather than relying on disperate parts.
Fields§
§chain: Chain<T>
§assigned: bool
Implementations§
Source§impl<T> MiddlewareChain<T>where
T: 'static,
impl<T> MiddlewareChain<T>where
T: 'static,
Sourcepub fn new() -> MiddlewareChain<T>
pub fn new() -> MiddlewareChain<T>
Creates a new, blank (i.e. will panic if run,) MiddlewareChain
pub fn assign_legacy(&mut self, chain: Chain<T>)
Sourcepub fn run(&self, context: T) -> Pin<Box<dyn Future<Output = T> + Send>>
pub fn run(&self, context: T) -> Pin<Box<dyn Future<Output = T> + Send>>
Run the middleware chain once
Sourcepub fn chain(&mut self, chain: MiddlewareChain<T>)
pub fn chain(&mut self, chain: MiddlewareChain<T>)
Concatenate two middleware chains. This will make this chains tail point
to the next chain. That means that calling next
in the final piece of
this chain will invoke the next chain rather than an “End of chain” panic
Sourcepub fn is_assigned(&self) -> bool
pub fn is_assigned(&self) -> bool
Tells if the chain has been assigned OR whether it is unassigned but has an assigned tail. If is only chained but has no assigned runnable, then this chain acts as a passthrough to the next one.
Trait Implementations§
Source§impl<T> Clone for MiddlewareChain<T>where
T: 'static,
impl<T> Clone for MiddlewareChain<T>where
T: 'static,
Source§fn clone(&self) -> MiddlewareChain<T>
fn clone(&self) -> MiddlewareChain<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more