Crate err_report

Crate err_report 

Source
Expand description

Clone of the unstable [err_report::Report] type.

Backtrace support is omitted due to nightly requirement.

Copied on 2025-09-09.

§Examples

use std::ffi::CString;
use err_report::Report;

let invalid_utf8 = vec![b'f', 0xff, b'o', b'o'];
let cstring = CString::new(invalid_utf8).unwrap();
let err = cstring.into_string().err().unwrap();

// without Report
assert_eq!(
    "invalid utf-8 sequence of 1 bytes from index 1",
    err.utf8_error().to_string(),
);
assert_eq!(
    "C string contained non-utf8 bytes",
    err.to_string(),
);

// with Report
assert_eq!(
    "invalid utf-8 sequence of 1 bytes from index 1",
    Report::new(err.utf8_error()).to_string(),
);
assert_eq!(
    "C string contained non-utf8 bytes: invalid utf-8 sequence of 1 bytes from index 1",
    Report::new(err).to_string(),
);

Structs§

Report
An error reporter that prints an error and its sources.

Traits§

Error
Error is a trait representing the basic expectations for error values, i.e., values of type E in Result<T, E>.