1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
//! The error module contains a generic error that is used by the rest of the crate. //! #[derive(Debug)] pub struct Error { details: String, } impl Error { pub fn new(msg: &str) -> Error { Error { details: msg.to_string(), } } } impl From<std::io::Error> for Error { fn from(e: std::io::Error) -> Error { Error::new(&e.to_string()) } }