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