Function fmt

Source
pub fn fmt<'a>(err: &'a dyn Error) -> impl Display + 'a
Expand description

Create a Display adapter that applies the formatting rules to any error.

ยงExample

use std::io;

let orig = errors::wrap("exploded", "cat hair in generator");
let err = io::Error::new(io::ErrorKind::Other, orig);

// Foreign type might not know how to format sources...
// But now it does!
assert_eq!(
    format!("{:+}", errors::fmt(&err)),
    "exploded: cat hair in generator"
);