pub struct ErrorFrame {
pub file: &'static str,
pub line: u32,
pub function: &'static str,
pub message: Cow<'static, str>,
}Expand description
A single frame in an error context chain, capturing the source location and a human-readable message at the point where context was attached.
Instances are typically created via the ctx! macro rather than
constructed by hand.
§Examples
use oximedia_core::error_context::ErrorFrame;
let frame = ErrorFrame {
file: "src/lib.rs",
line: 10,
function: "my_func",
message: std::borrow::Cow::Borrowed("something went wrong"),
};
let s = frame.to_string();
assert!(s.contains("src/lib.rs"));
assert!(s.contains("10"));
assert!(s.contains("my_func"));
assert!(s.contains("something went wrong"));Fields§
§file: &'static strSource file path captured by file!().
line: u32Line number captured by line!().
function: &'static strFunction or module path captured by the current_fn_name!() macro.
message: Cow<'static, str>Human-readable context message.
Trait Implementations§
Source§impl Clone for ErrorFrame
impl Clone for ErrorFrame
Source§fn clone(&self) -> ErrorFrame
fn clone(&self) -> ErrorFrame
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 ErrorFrame
impl Debug for ErrorFrame
Auto Trait Implementations§
impl Freeze for ErrorFrame
impl RefUnwindSafe for ErrorFrame
impl Send for ErrorFrame
impl Sync for ErrorFrame
impl Unpin for ErrorFrame
impl UnsafeUnpin for ErrorFrame
impl UnwindSafe for ErrorFrame
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