1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use std::io; #[derive(Debug)] pub enum Error { Io(io::Error), Program(&'static str), } impl From<io::Error> for Error { fn from(e: io::Error) -> Error { Error::Io(e) } } impl From<&'static str> for Error { fn from(e: &'static str) -> Error { Error::Program(e) } }