3 unstable releases

0.2.0 Mar 21, 2020
0.1.1 Mar 20, 2020
0.1.0 Mar 19, 2020

#624 in Debugging

45 downloads per month

MIT license

5KB

trace_caller

Build Status Latest version MIT licensed Stability stable

This procedural attribute macro will allow retrieving the caller's source location in the stable Rust. Rust has also this feature, but it is currently unstable and available in nightly-only build. But with this attribute, you can use this feature on stable Rust.

It will help to trace the location of the caller of a function.

Example

use trace_caller::trace;

#[trace]
fn add(x: u32, y: u32) -> u32 {
    x + y
}

fn main() {
    let result = add(3, 4);
    println!("Result: {}", result);
}

Result

Called from "src/main.rs" at line 11
Result: 7

Dependencies

~2.4–3.5MB
~70K SLoC