pub struct CallStack(pub Vec<CallStackLine>);Expand description
A parsed JavaScript call stack.
This type parses a newline-separated call stack string and provides methods to extract different levels of location detail for log messages.
§Examples
use tauri_plugin_tracing::CallStack;
// Parse a simple call stack
let stack = CallStack::new(Some("Error\n at foo (src/app.ts:10:5)\n at bar (src/lib.ts:20:3)"));
// Get just the filename (last component after '/')
assert_eq!(stack.file_name().as_str(), "lib.ts:20:3)");
// Get the full path of the last frame
assert_eq!(stack.path().as_str(), " at bar (src/lib.ts:20:3)");use tauri_plugin_tracing::CallStack;
// node_modules paths are filtered out
let stack = CallStack::new(Some("Error\n at node_modules/lib/index.js:1:1\n at src/app.ts:10:5"));
let location = stack.location();
assert!(!location.contains("node_modules"));Tuple Fields§
§0: Vec<CallStackLine>Implementations§
Source§impl CallStack
impl CallStack
Sourcepub fn location(&self) -> CallStackLine
pub fn location(&self) -> CallStackLine
Returns the full filtered location as a #-separated string.
This includes all stack frames that pass the filter (excluding
node_modules and native code), joined with #.
Used for trace and error log levels.
Sourcepub fn path(&self) -> CallStackLine
pub fn path(&self) -> CallStackLine
Returns the path of the last (most recent) stack frame.
This extracts just the last location from the full call stack.
Used for debug and warn log levels.
Sourcepub fn file_name(&self) -> CallStackLine
pub fn file_name(&self) -> CallStackLine
Returns just the filename (without path) of the most recent stack frame.
This is the most concise location format.
Used for info log level.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CallStack
impl<'de> Deserialize<'de> for CallStack
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CallStack
impl RefUnwindSafe for CallStack
impl Send for CallStack
impl Sync for CallStack
impl Unpin for CallStack
impl UnwindSafe for CallStack
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