code-path 0.4.0

A code path macro
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::{Context, Result};
use code_path::code_path;

fn main() -> anyhow::Result<()> {
    configure()
}

fn configure() -> Result<()> {
    let filename = "config.toml";
    let _ = load_config(filename)
        .context(filename)
        .context(code_path!())?;
    Ok(())
}

fn load_config(filename: &str) -> Result<String> {
    std::fs::read_to_string(filename).context(code_path!())
}