🎈 thisctx

A small crate works with thiserror to create errors with contexts, inspired by snafu.

✍️ Examples

```rust use std::path::{Path, PathBuf}; use thisctx::WithContext; use thiserror::Error;

[derive(Debug, Error, WithContext)]

pub enum Error { #[error("I/O failed '{path}': {source}")] IoFaild { source: std::io::Error, path: PathBuf, }, }

fn loadconfig(path: &Path) -> Result { std::fs::readto_string(path).context(IoFaildContext { path }) } ```

📝 Todo

🚩 Minimal suppoted Rust version

All tests under tests/* passed with rustc v1.33, previous versions may not compile.

⚖️ License

Licensed under either of

at your option.