#[non_exhaustive]pub struct ErrorContext<'a> {
pub caption: &'a str,
pub kind: &'a str,
pub level: ErrorLevel,
pub is_fatal: bool,
pub is_retryable: bool,
}Expand description
Error context passed to registered hooks.
Marked #[non_exhaustive] so future minor releases can add new
fields without breaking callers that destructure the struct.
Construct via ErrorContext::new (rather than struct-literal
syntax) from outside the crate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.caption: &'a strThe error caption
kind: &'a strThe error kind
level: ErrorLevelThe error level
is_fatal: boolWhether the error is fatal
is_retryable: boolWhether the error can be retried
Implementations§
Source§impl<'a> ErrorContext<'a>
impl<'a> ErrorContext<'a>
Sourcepub fn new(
caption: &'a str,
kind: &'a str,
level: ErrorLevel,
is_fatal: bool,
is_retryable: bool,
) -> Self
pub fn new( caption: &'a str, kind: &'a str, level: ErrorLevel, is_fatal: bool, is_retryable: bool, ) -> Self
Construct an ErrorContext from its components.
Provided so external callers (tests, custom hook wiring) can
build the struct without depending on its field list, which
may grow over the 1.x line.
Auto Trait Implementations§
impl<'a> Freeze for ErrorContext<'a>
impl<'a> RefUnwindSafe for ErrorContext<'a>
impl<'a> Send for ErrorContext<'a>
impl<'a> Sync for ErrorContext<'a>
impl<'a> Unpin for ErrorContext<'a>
impl<'a> UnsafeUnpin for ErrorContext<'a>
impl<'a> UnwindSafe for ErrorContext<'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