pub struct ErrorContext { /* private fields */ }Expand description
Structured context attached to a single error occurrence.
Records where an error happened (component, operation) and a
human-readable message. Optional key/value pairs may carry additional
diagnostic information.
§Examples
use oximedia_core::error_context::ErrorContext;
let ctx = ErrorContext::new("muxer", "write_header", "disk full");
assert_eq!(ctx.component(), "muxer");
assert_eq!(ctx.operation(), "write_header");
assert_eq!(ctx.message(), "disk full");Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn new(component: &str, operation: &str, message: &str) -> Self
pub fn new(component: &str, operation: &str, message: &str) -> Self
Creates a new context with the given component, operation, and message.
Sourcepub fn with_field(&mut self, key: &str, value: &str) -> &mut Self
pub fn with_field(&mut self, key: &str, value: &str) -> &mut Self
Attaches an additional key/value diagnostic field.
Calling this multiple times with the same key overwrites the previous value.
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorContext
impl Debug for ErrorContext
Source§impl Display for ErrorContext
impl Display for ErrorContext
Source§impl PartialEq for ErrorContext
impl PartialEq for ErrorContext
impl Eq for ErrorContext
impl StructuralPartialEq for ErrorContext
Auto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnsafeUnpin for ErrorContext
impl UnwindSafe for ErrorContext
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