pub trait VirtualStackTrace {
// Required method
fn virtual_stack(&self) -> Vec<StackFrame>;
}Expand description
Core trait for virtual stack trace functionality.
This trait is automatically implemented by the stack_trace_debug proc macro attribute.
It provides access to the virtual stack trace showing the error propagation path.
§Example
use snafu::prelude::*;
use snafu_virtstack::{stack_trace_debug, VirtualStackTrace};
#[derive(Snafu)]
#[stack_trace_debug]
enum MyError {
#[snafu(display("Something went wrong"))]
SomethingWrong,
}
let error = MyError::SomethingWrong;
let stack = error.virtual_stack();
for frame in stack {
println!("{}", frame);
}Required Methods§
Sourcefn virtual_stack(&self) -> Vec<StackFrame>
fn virtual_stack(&self) -> Vec<StackFrame>
Returns a virtual stack trace showing error propagation path.
Each StackFrame in the returned vector represents one step in the error
propagation chain, from the outermost error context down to the root cause.