pub struct Next { /* private fields */ }Expand description
Opaque continuation passed to a Middleware. Calling Next::run
proceeds to the next middleware in the chain or to the Terminal if
the chain is empty.
Implementations§
Source§impl Next
impl Next
Sourcepub fn new(
middlewares: Vec<Arc<dyn DynMiddleware>>,
terminal: Arc<dyn Terminal>,
) -> Self
pub fn new( middlewares: Vec<Arc<dyn DynMiddleware>>, terminal: Arc<dyn Terminal>, ) -> Self
Builds a new Next from a chain of middlewares and a terminal.
Middlewares are executed in the order they appear in the slice: the first one wraps the second, which wraps the third, and so on.
Sourcepub async fn run(
self,
envelope: &MessageEnvelope,
ctx: &HandlerContext,
) -> Result<BoxOutput, HexeractError>
pub async fn run( self, envelope: &MessageEnvelope, ctx: &HandlerContext, ) -> Result<BoxOutput, HexeractError>
Advances the pipeline by one step.
§Errors
Returns the HexeractError produced by the next middleware in the
chain or by the Terminal when the chain is exhausted.
Auto Trait Implementations§
impl Freeze for Next
impl !RefUnwindSafe for Next
impl Send for Next
impl Sync for Next
impl Unpin for Next
impl UnsafeUnpin for Next
impl !UnwindSafe for Next
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more