anyhow-std 0.1.4

Wrap std APIs with anyhow error context.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[test]
fn wrap_read_dir_item_err() {
    use std::io::{Error, ErrorKind::Other};

    if let Some(Err(err)) = super::wrap_read_dir_item(
        std::path::Path::new("fake-path"),
        Some(Err(Error::new(Other, "fake ReadDir iteration error"))),
    ) {
        assert_eq!(
            r#"while reading directory "fake-path": fake ReadDir iteration error"#,
            format!("{err:#}"),
        );
    } else {
        unreachable!();
    }
}