rust-sen/sehn/src/se/error.rs

20 lines
460 B
Rust

use core::fmt;
pub enum SerializerError {
/// A unexpected error (should never get this).
Unexpected(&'static str)
}
impl fmt::Debug for SerializerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use SerializerError::*;
match self {
Unexpected(ref err) => write!(f, "unexpected error: {}", err)
}
}
}
pub trait Error: fmt::Debug + From<SerializerError> {}
impl<T> Error for T where
T: fmt::Debug + From<SerializerError> {}