openethereum/src/rlp/rlperrors.rs

31 lines
601 B
Rust
Raw Normal View History

2015-12-08 12:59:19 +01:00
use std::fmt;
use std::error::Error as StdError;
use bytes::FromBytesError;
#[derive(Debug, PartialEq, Eq)]
pub enum DecoderError {
FromBytesError(FromBytesError),
RlpIsTooShort,
RlpExpectedToBeList,
RlpExpectedToBeData,
2015-12-14 11:56:11 +01:00
RlpIncorrectListLen
2015-12-08 12:59:19 +01:00
}
impl StdError for DecoderError {
fn description(&self) -> &str {
"builder error"
}
}
impl fmt::Display for DecoderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self, f)
}
}
impl From<FromBytesError> for DecoderError {
fn from(err: FromBytesError) -> DecoderError {
DecoderError::FromBytesError(err)
}
}