pub struct RegisteredPostProcessingMiddleware<'a> { /* private fields */ }
Expand description
The type returned by Blueprint::post_process
.
It allows you to further configure the behaviour of post-processing middleware you just registered.
Implementations§
source§impl<'a> RegisteredPostProcessingMiddleware<'a>
impl<'a> RegisteredPostProcessingMiddleware<'a>
sourcepub fn error_handler(self, error_handler: RawIdentifiers) -> Self
pub fn error_handler(self, error_handler: RawIdentifiers) -> Self
Register an error handler.
If an error handler has already been registered for this middleware, it will be overwritten.
§Guide
Check out the “Error handlers” section of Pavex’s guide for a thorough introduction to error handlers in Pavex applications.
§Example
use pavex::{f, blueprint::Blueprint};
use pavex::response::Response;
// 👇 a fallible post-processing middleware
fn max_response_size(response: Response) -> Result<Response, SizeError>
{
// [...]
}
fn error_to_response(error: &SizeError) -> Response {
// [...]
}
let mut bp = Blueprint::new();
bp.post_process(f!(crate::max_response_size))
.error_handler(f!(crate::error_to_response));
Auto Trait Implementations§
impl<'a> Freeze for RegisteredPostProcessingMiddleware<'a>
impl<'a> RefUnwindSafe for RegisteredPostProcessingMiddleware<'a>
impl<'a> Send for RegisteredPostProcessingMiddleware<'a>
impl<'a> Sync for RegisteredPostProcessingMiddleware<'a>
impl<'a> Unpin for RegisteredPostProcessingMiddleware<'a>
impl<'a> !UnwindSafe for RegisteredPostProcessingMiddleware<'a>
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