pub trait IPipelineBehavior: Send + Sync {
// Required method
fn handle<'life0, 'async_trait>(
&'life0 self,
req: Box<dyn Any + Send>,
next: Box<dyn FnOnce(Box<dyn Any + Send>) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send>> + Send>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Pipeline behavior that wraps around request handling.
Multiple behaviors form a chain. Each behavior can:
- Inspect or modify the request before passing it on
- Inspect or modify the response after it returns
- Short-circuit and skip the rest of the chain (by not calling
next)
Behaviors resolve dependencies via constructor injection (registered as Singleton in the DI container), following the MediatR pattern.
Analogous to MediatR’s IPipelineBehavior<TRequest, TResponse>.
Required Methods§
fn handle<'life0, 'async_trait>(
&'life0 self,
req: Box<dyn Any + Send>,
next: Box<dyn FnOnce(Box<dyn Any + Send>) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send>> + Send>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".