spannify

Crates.iospannify
lib.rsspannify
version0.1.5
sourcesrc
created_at2024-07-29 15:30:49.202939
updated_at2024-08-02 13:53:00.845017
descriptionA crate that produces nice-looking graphs to visualize your callstack.
homepagehttps://github.com/mikeyQwn/spannify
repositoryhttps://github.com/mikeyQwn/spannify
max_upload_size
id1318977
size28,890
mikeyQwn (mikeyQwn)

documentation

https://docs.rs/spannify

README

Spannify

Build status Crates.io License

A tiny rust crate that produces nice-looking graphs for you to visualize your callstack

Example

use once_cell::sync::Lazy;
use spannify::{config::Config, core::StdoutSpanner, spf};

static SPANNER: Lazy<StdoutSpanner> =
    Lazy::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);
}

Output

┌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)

Documentation

Check out the full documentation at docs.rs Or take a look at the examples in examples

Commit count: 0

cargo fmt