| Crates.io | spannify |
| lib.rs | spannify |
| version | 0.2.5 |
| created_at | 2024-07-29 15:30:49.202939+00 |
| updated_at | 2025-01-29 02:15:20.940898+00 |
| description | A crate that produces nice-looking graphs to visualize your callstack. |
| homepage | https://github.com/mikeyQwn/spannify |
| repository | https://github.com/mikeyQwn/spannify |
| max_upload_size | |
| id | 1318977 |
| size | 30,712 |
A tiny rust crate that produces nice-looking graphs for you to visualize your callstack
Spannify does not have any dependencies
Here's an example of using spannify to trace calls to a recursive function.
Make sure you've added spannify to your project:
$ cargo add spannify
use spannify::{config::Config, core::StdoutSpanner, spf};
use std::sync::LazyLock;
static SPANNER: LazyLock<StdoutSpanner> =
LazyLock::new(|| StdoutSpanner::new().with_config(Config::new().with_skip(1)));
fn fib(n: usize) -> usize {
let _span = spf!(SPANNER, "fib({n})");
match n {
0 => 0,
1 | 2 => 1,
_ => fib(n - 1) + fib(n - 2),
}
}
fn main() {
fib(5);
}
┌fib(5)
| ┌fib(4)
| ¦ ┌fib(3)
| ¦ ┆ ┌fib(2)
| ¦ ┆ └fib(2)
| ¦ ┆ ┌fib(1)
| ¦ ┆ └fib(1)
| ¦ └fib(3)
| ¦ ┌fib(2)
| ¦ └fib(2)
| └fib(4)
| ┌fib(3)
| ¦ ┌fib(2)
| ¦ └fib(2)
| ¦ ┌fib(1)
| ¦ └fib(1)
| └fib(3)
└fib(5)
This and other examples can be found in the examples directory
Check out the full documentation at docs.rs