pub struct StackFrame {
pub location: &'static Location<'static>,
pub message: String,
}Expand description
Represents a single frame in the virtual stack trace.
Each frame captures the location where an error was propagated and the associated error message. This provides precise context about the error propagation path without the overhead of system backtraces.
Fields§
§location: &'static Location<'static>Location where the error occurred or was propagated
message: StringError message for this frame
Implementations§
Source§impl StackFrame
impl StackFrame
Sourcepub fn new(location: &'static Location<'static>, message: String) -> Self
pub fn new(location: &'static Location<'static>, message: String) -> Self
Creates a new stack frame with the given location and message.
§Arguments
location- The location where the error occurred, typically fromstd::panic::Location::caller()message- A descriptive message for this error frame
§Example
use snafu_virtstack::StackFrame;
use std::panic::Location;
#[track_caller]
fn create_frame() -> StackFrame {
StackFrame::new(
Location::caller(),
"Something went wrong".to_string()
)
}Trait Implementations§
Source§impl Clone for StackFrame
impl Clone for StackFrame
Source§fn clone(&self) -> StackFrame
fn clone(&self) -> StackFrame
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 StackFrame
impl Debug for StackFrame
Auto Trait Implementations§
impl Freeze for StackFrame
impl RefUnwindSafe for StackFrame
impl Send for StackFrame
impl Sync for StackFrame
impl Unpin for StackFrame
impl UnwindSafe for StackFrame
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