scoped-trace 0.1.0

Collect scoped backtraces.
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented1 out of 4 items with examples
  • Size
  • Source code size: 40.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jswrenn/scoped-trace
    24 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jswrenn

scoped-trace

Capture scoped backtraces.

Use Trace::root to define the upper unwinding bound of an execution trace, and Trace::leaf to define its lower bounds (the points at which backtraces are collected). The resulting traces are trees, since a single invocation of Trace::root may have multiple sub-invocations of Trace::leaf.

For example, running this program:

use scoped_trace::Trace;

fn main() {
    let (_, trace) = Trace::root(|| foo());
    println!("{trace}");
}

fn foo() {
    bar();
    baz();
}

fn bar() {
    Trace::leaf();
}

fn baz() {
    Trace::leaf();
}

...will produce an output like:

╼ inlining::main::{{closure}} at example.rs:4:38
  ├╼ inlining::foo at example.rs:9:5
  │  └╼ inlining::bar at example.rs:14:5
  └╼ inlining::foo at example.rs:10:5
     └╼ inlining::baz at example.rs:18:5

License

This project is licensed under the Apache License, Version 2.0, or the MIT license, at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in scoped-trace by you, shall be licensed as MIT and Apache 2.0, without any additional terms or conditions.