pub struct ErrorResponseBuilder { /* private fields */ }
Expand description
A builder for constructing ErrorResponseContext
instances.
This builder provides a fluent interface for setting error context properties and ensures that contexts are created in a consistent manner.
§Example
use axum_error_handler::ErrorResponseContext;
let context = ErrorResponseContext::builder()
.status_code(422)
.code("VALIDATION_FAILED".to_string())
.message("The provided data failed validation".to_string())
.build();
Implementations§
Source§impl ErrorResponseBuilder
impl ErrorResponseBuilder
Sourcepub fn new() -> ErrorResponseBuilder
pub fn new() -> ErrorResponseBuilder
Creates a new empty builder.
Sourcepub fn code(self, code: String) -> ErrorResponseBuilder
pub fn code(self, code: String) -> ErrorResponseBuilder
Sourcepub fn message(self, message: String) -> ErrorResponseBuilder
pub fn message(self, message: String) -> ErrorResponseBuilder
Sourcepub fn status_code(self, status_code: u16) -> ErrorResponseBuilder
pub fn status_code(self, status_code: u16) -> ErrorResponseBuilder
Sourcepub fn build(self) -> ErrorResponseContext
pub fn build(self) -> ErrorResponseContext
Builds the final ErrorResponseContext
with the configured values.
§Returns
A new ErrorResponseContext
instance with the values set on this builder.
Auto Trait Implementations§
impl Freeze for ErrorResponseBuilder
impl RefUnwindSafe for ErrorResponseBuilder
impl Send for ErrorResponseBuilder
impl Sync for ErrorResponseBuilder
impl Unpin for ErrorResponseBuilder
impl UnwindSafe for ErrorResponseBuilder
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