[−][src]Trait declio::Decode
A type that can be decoded from a byte stream.
Required methods
fn decode<R>(ctx: Ctx, reader: &mut R) -> Result<Self, Error> where
R: Read,
R: Read,
Decodes a value from the given reader.
Implementations on Foreign Types
impl<T, Ctx> Decode<(Len, Ctx)> for Vec<T> where
T: Decode<Ctx>,
Ctx: Clone,
[src]
T: Decode<Ctx>,
Ctx: Clone,
fn decode<R>(
(Len, inner_ctx): (Len, Ctx),
reader: &mut R
) -> Result<Self, Error> where
R: Read,
[src]
(Len, inner_ctx): (Len, Ctx),
reader: &mut R
) -> Result<Self, Error> where
R: Read,
Decodes multiple values of type T
, collecting them in a Vec
.
The length of the vector / number of elements decoded is equal to the value of the
Len
context.
impl<T> Decode<Len> for Vec<T> where
T: Decode,
[src]
T: Decode,
fn decode<R>(len: Len, reader: &mut R) -> Result<Self, Error> where
R: Read,
[src]
R: Read,
Decodes multiple values of type T
, collecting them in a Vec
.
The length of the vector / number of elements decoded is equal to the value of the
Len
context.
impl<T, Ctx> Decode<Ctx> for Option<T> where
T: Decode<Ctx>,
[src]
T: Decode<Ctx>,
fn decode<R>(inner_ctx: Ctx, reader: &mut R) -> Result<Self, Error> where
R: Read,
[src]
R: Read,
Decodes a value of type T
and wraps it in Some
.
Detecting and deserializing a None
should be done outside of this function by
checking the relevant conditions in other decoded values and skipping this call if a
None
is expected.
Since serializing a None
writes nothing, deserialization is also a no-op; just construct
a value of None
.
impl<'a, T: ?Sized, Ctx> Decode<Ctx> for Cow<'a, T> where
T: ToOwned,
T::Owned: Decode<Ctx>,
[src]
T: ToOwned,
T::Owned: Decode<Ctx>,
fn decode<R>(inner_ctx: Ctx, reader: &mut R) -> Result<Self, Error> where
R: Read,
[src]
R: Read,
Decodes a value of type T::Owned
.
impl<T, Ctx> Decode<Ctx> for Box<T> where
T: Decode<Ctx>,
[src]
T: Decode<Ctx>,
fn decode<R>(inner_ctx: Ctx, reader: &mut R) -> Result<Self, Error> where
R: Read,
[src]
R: Read,
Decodes a value of type T
and boxes it.
impl Decode<()> for ()
[src]
impl Decode<()> for bool
[src]
fn decode<R>(_: (), reader: &mut R) -> Result<Self, Error> where
R: Read,
[src]
R: Read,
Decodes a 1-byte as true
, a 0-byte as false
, and any other byte value as an error.