mod decoder; mod error; use crate::filler::Filler; pub use decoder::Decoder; pub use error::Error; pub trait Decode<'b>: Sized { fn decode(d: &mut Decoder) -> Result; } impl Decode<'_> for Filler { fn decode(d: &mut Decoder) -> Result { d.filler()?; Ok(Filler::FillerEnd) } } impl Decode<'_> for Vec { fn decode(d: &mut Decoder) -> Result { d.bytes() } } impl Decode<'_> for u8 { fn decode(d: &mut Decoder) -> Result { d.u8() } } impl Decode<'_> for isize { fn decode(d: &mut Decoder) -> Result { d.integer() } } impl Decode<'_> for i128 { fn decode(d: &mut Decoder) -> Result { d.big_integer() } } impl Decode<'_> for usize { fn decode(d: &mut Decoder) -> Result { d.word() } } impl Decode<'_> for char { fn decode(d: &mut Decoder) -> Result { d.char() } } impl Decode<'_> for String { fn decode(d: &mut Decoder) -> Result { d.utf8() } } impl Decode<'_> for bool { fn decode(d: &mut Decoder) -> Result { d.bool() } }