pub struct Frame {
pub filename: String,
pub lineno: usize,
pub name: String,
pub line: String,
pub locals: Option<BTreeMap<String, String>>,
}Expand description
A single stack frame in a traceback.
Represents one level in the call stack, including the source location, function name, source line, and optionally local variables.
Fields§
§filename: StringThe source file path.
lineno: usizeThe line number (1-based).
name: StringThe function or method name.
line: StringThe source code line (may be empty if unavailable).
locals: Option<BTreeMap<String, String>>Local variables as debug strings (name -> repr).
Uses BTreeMap for deterministic ordering.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn with_locals(self, locals: BTreeMap<String, String>) -> Self
pub fn with_locals(self, locals: BTreeMap<String, String>) -> Self
Set the local variables for this frame.
Sourcepub fn add_local(&mut self, name: impl Into<String>, value: impl Into<String>)
pub fn add_local(&mut self, name: impl Into<String>, value: impl Into<String>)
Add a single local variable.
Sourcepub fn has_locals(&self) -> bool
pub fn has_locals(&self) -> bool
Check if this frame has local variables.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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