Function string_error::new_err [−][src]
pub fn new_err(e: &str) -> Box<dyn Error>
Expand description
Creates an error trait object for a string (&str
).
This copies the argument into an owned string. To avoid the copy, use
either into_err
or static_err
.
Examples
use string_error::*; let x = new_err("Foo"); assert_eq!(x.description(), "Foo");