use std::error::Error;
use std::fmt::{Display, Formatter, Result as FResult};
use error_trace::toplevel;
#[derive(Debug)]
struct NestedError;
impl Display for NestedError {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> FResult { write!(f, "Something occurred initially") }
}
impl Error for NestedError {}
fn main() {
eprintln!("ERROR: {}", toplevel!(("Something occurred as a result of something else"), NestedError));
let value: u32 = 42;
eprintln!("ERROR: {}", toplevel!(("Cannot set to {value}"), NestedError));
#[cfg(feature = "colors")]
eprintln!("ERROR: {}", error_trace::toplevel_colored!(("Something occurred as a result of something else"), NestedError));
}