pub struct Traceback {Show 13 fields
pub trace: Trace,
pub width: Option<usize>,
pub extra_lines: usize,
pub theme: Option<String>,
pub word_wrap: bool,
pub show_locals: bool,
pub locals_max_length: Option<usize>,
pub locals_max_string: Option<usize>,
pub locals_hide_dunder: bool,
pub locals_hide_sunder: bool,
pub indent_guides: bool,
pub suppress: Vec<String>,
pub max_frames: usize,
}Expand description
Traceback display configuration and data.
Holds a Trace and configuration options for rendering.
Rendering is not yet implemented - this is the struct definition only.
§Example
use rich_rs::traceback::{Frame, Stack, Trace, Traceback};
let frame = Frame::new("main.rs", 10, "main")
.with_line(" let x = foo();");
let stack = Stack::new("PanicInfo", "called `Result::unwrap()` on an `Err` value")
.with_frame(frame);
let trace = Trace::new(vec![stack]);
// Using new() with defaults
let tb = Traceback::new(trace.clone());
// Using builder pattern for customization
let tb = Traceback::builder(trace)
.width(100)
.show_locals(true)
.theme("monokai")
.build();Fields§
§trace: TraceThe trace data.
width: Option<usize>Display width (None = use console width).
extra_lines: usizeNumber of extra context lines around the error line.
theme: Option<String>Syntax highlighting theme name.
word_wrap: boolEnable word wrapping of long lines.
show_locals: boolShow local variables in each frame.
locals_max_length: Option<usize>Maximum length for container locals before abbreviating.
locals_max_string: Option<usize>Maximum string length for locals before truncating.
locals_hide_dunder: boolHide locals prefixed with double underscore.
locals_hide_sunder: boolHide locals prefixed with single underscore.
indent_guides: boolShow indent guides in code.
suppress: Vec<String>Modules/paths to suppress from the traceback.
max_frames: usizeMaximum number of frames to show (0 = unlimited).
Implementations§
Source§impl Traceback
impl Traceback
Sourcepub fn builder(trace: Trace) -> TracebackBuilder
pub fn builder(trace: Trace) -> TracebackBuilder
Sourcepub fn should_show_locals(&self) -> bool
pub fn should_show_locals(&self) -> bool
Check if local variables should be displayed.
Sourcepub fn filter_locals(
&self,
locals: &BTreeMap<String, String>,
) -> BTreeMap<String, String>
pub fn filter_locals( &self, locals: &BTreeMap<String, String>, ) -> BTreeMap<String, String>
Filter locals based on hide settings.
Returns a new BTreeMap with hidden variables removed.
Sourcepub fn is_suppressed(&self, path: &str) -> bool
pub fn is_suppressed(&self, path: &str) -> bool
Check if a path should be suppressed.