Crate code_path

source ·
Expand description

code-path

A code path macro

Usage

use code_path::code_path;

fn foo() -> &'static str {
    fn bar() -> &'static str {
        code_path!()
    }
    bar()
}

assert_eq!(foo(), "rust_out::main::_doctest_main_src_lib_rs_6_0::foo::bar");

Macros

  • Returns the current code path. It could be used in errors, logs, etc to avoid typos.