Function new

Source
pub fn new<D>(err: D) -> impl Error
where D: Debug + Display + Send + Sync + 'static,
Expand description

Simple way to create an error value.

ยงExample

let err = errors::new("sound the alarm");

assert_eq!(err.to_string(), "sound the alarm");
Examples found in repository?
examples/smoke.rs (line 17)
15fn two() -> Result<(), E> {
16    println!("> two");
17    Err(errors::new("kaboom").into())
18}