pub struct CommandPipeline<C>where
C: Command + 'static,{ /* private fields */ }Expand description
Ordered middleware pipeline ending in one typed command handler.
Middleware runs in registration order before the handler and unwinds in
reverse order after it. The pipeline also implements CommandHandler<C>,
so existing application services and saga processors can receive it without
depending on a new abstraction.
Implementations§
Source§impl<C> CommandPipeline<C>where
C: Command + 'static,
impl<C> CommandPipeline<C>where
C: Command + 'static,
Sourcepub fn new(handler: Arc<dyn CommandHandler<C>>) -> Self
pub fn new(handler: Arc<dyn CommandHandler<C>>) -> Self
Creates an empty pipeline ending in handler.
Sourcepub fn with_middleware(self, middleware: Arc<dyn CommandMiddleware<C>>) -> Self
pub fn with_middleware(self, middleware: Arc<dyn CommandMiddleware<C>>) -> Self
Appends middleware and returns the updated pipeline.
Sourcepub fn push_middleware(&mut self, middleware: Arc<dyn CommandMiddleware<C>>)
pub fn push_middleware(&mut self, middleware: Arc<dyn CommandMiddleware<C>>)
Appends middleware after every previously registered layer.
Sourcepub fn middleware_count(&self) -> usize
pub fn middleware_count(&self) -> usize
Returns the number of registered middleware layers.
Trait Implementations§
Source§impl<C> CommandHandler<C> for CommandPipeline<C>where
C: Command + 'static,
impl<C> CommandHandler<C> for CommandPipeline<C>where
C: Command + 'static,
Auto Trait Implementations§
impl<C> !RefUnwindSafe for CommandPipeline<C>
impl<C> !UnwindSafe for CommandPipeline<C>
impl<C> Freeze for CommandPipeline<C>
impl<C> Send for CommandPipeline<C>
impl<C> Sync for CommandPipeline<C>
impl<C> Unpin for CommandPipeline<C>
impl<C> UnsafeUnpin for CommandPipeline<C>
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