1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
quick_error! { #[derive(Debug)] pub enum ProtocolError { GrammarCheckFailed(s: &'static str) { description(s) } ConnectionClosed CommandNotSupport(s: String) { display("Command {} is not supported", s) } Utf8Error(err: std::str::Utf8Error) { from() } ParseError(err: std::num::ParseIntError) { from() } IOError(err: std::io::Error) { from() } } } pub type Result<T> = std::result::Result<T, ProtocolError>;