#[derive(Debug, PartialEq)]
pub enum CodecError<RE, WE> {
DecodeError(DecodeError<RE>),
EncodeError(EncodeError<WE>),
}
impl<RE, WE> From<DecodeError<RE>> for CodecError<RE, WE> {
#[inline]
fn from(e: DecodeError<RE>) -> Self {
CodecError::DecodeError(e)
}
}
impl<RE, WE> From<DecodeFingerprintError<RE>> for CodecError<RE, WE> {
#[inline]
fn from(e: DecodeFingerprintError<RE>) -> Self {
CodecError::DecodeError(DecodeError::DecodeFingerprintError(e))
}
}
impl<RE, WE> From<DecodeValueError<RE>> for CodecError<RE, WE> {
#[inline]
fn from(e: DecodeValueError<RE>) -> Self {
CodecError::DecodeError(DecodeError::DecodeValueError(e))
}
}
impl<RE, WE> From<EncodeError<WE>> for CodecError<RE, WE> {
#[inline]
fn from(e: EncodeError<WE>) -> Self {
CodecError::EncodeError(e)
}
}
impl<RE, WE> From<EncodeFingerprintError<WE>> for CodecError<RE, WE> {
#[inline]
fn from(e: EncodeFingerprintError<WE>) -> Self {
CodecError::EncodeError(EncodeError::EncodeFingerprintError(e))
}
}
impl<RE, WE> From<EncodeValueError<WE>> for CodecError<RE, WE> {
#[inline]
fn from(e: EncodeValueError<WE>) -> Self {
CodecError::EncodeError(EncodeError::EncodeValueError(e))
}
}
#[derive(Debug, PartialEq)]
pub enum DecodeError<E> {
DecodeFingerprintError(DecodeFingerprintError<E>),
DecodeValueError(DecodeValueError<E>),
}
impl<E> From<DecodeFingerprintError<E>> for DecodeError<E> {
#[inline]
fn from(e: DecodeFingerprintError<E>) -> Self {
DecodeError::DecodeFingerprintError(e)
}
}
impl<E> From<DecodeValueError<E>> for DecodeError<E> {
#[inline]
fn from(e: DecodeValueError<E>) -> Self {
DecodeError::DecodeValueError(e)
}
}
#[derive(Debug, PartialEq)]
pub enum DecodeFingerprintError<E> {
InvalidFingerprint(u64),
ReaderError(E),
}
impl<E> From<E> for DecodeFingerprintError<E> {
#[inline]
fn from(e: E) -> Self {
DecodeFingerprintError::ReaderError(e)
}
}
#[derive(Debug, PartialEq)]
pub enum DecodeValueError<E> {
ArrayLengthMismatch(&'static str),
InvalidValue(&'static str),
ReaderError(E),
}
impl<E> From<E> for DecodeValueError<E> {
#[inline]
fn from(e: E) -> Self {
DecodeValueError::ReaderError(e)
}
}
#[derive(Debug, PartialEq)]
pub enum EncodeError<E> {
EncodeFingerprintError(EncodeFingerprintError<E>),
EncodeValueError(EncodeValueError<E>),
}
impl<E> From<EncodeFingerprintError<E>> for EncodeError<E> {
#[inline]
fn from(e: EncodeFingerprintError<E>) -> Self {
EncodeError::EncodeFingerprintError(e)
}
}
impl<E> From<EncodeValueError<E>> for EncodeError<E> {
#[inline]
fn from(e: EncodeValueError<E>) -> Self {
EncodeError::EncodeValueError(e)
}
}
#[derive(Debug, PartialEq)]
pub enum EncodeFingerprintError<E> {
WriterError(E),
}
impl<E> From<E> for EncodeFingerprintError<E> {
#[inline]
fn from(e: E) -> Self {
EncodeFingerprintError::WriterError(e)
}
}
#[derive(Debug, PartialEq, Eq)]
pub enum EncodeValueError<E> {
ArrayLengthMismatch(&'static str),
InvalidValue(&'static str),
WriterError(E),
}
impl<E> From<E> for EncodeValueError<E> {
#[inline]
fn from(e: E) -> Self {
EncodeValueError::WriterError(e)
}
}