Code Snippets

// Cargo.toml: anyhow = "1"
use anyhow::{Context, Result};
use std::fs;

fn main() -> Result<()> {
    let path = "config.toml";
    let body = fs::read_to_string(path)
        .with_context(|| format!("reading {path}"))?;
    println!("{body}");
    Ok(())
}