Trait probor::Decode
[−]
[src]
pub trait Decode: Sized { fn decode_elem<R: Input>(
d: &mut Decoder<R>,
n: usize
) -> Result<Self, DecodeError>; fn decode_field<R: Input>(
d: &mut Decoder<R>,
name: &'static str
) -> Result<Self, DecodeError>; }
Required Methods
fn decode_elem<R: Input>(
d: &mut Decoder<R>,
n: usize
) -> Result<Self, DecodeError>
d: &mut Decoder<R>,
n: usize
) -> Result<Self, DecodeError>
Decodes non-null array element and correctly propagates error.
The n
is used only for errors
Propagating errors with try!(decode()) is dangerous as it may propagate UnexpectedNull in the middle of an array, which user may think it's just null. try!(decode_elem()) is safe
fn decode_field<R: Input>(
d: &mut Decoder<R>,
name: &'static str
) -> Result<Self, DecodeError>
d: &mut Decoder<R>,
name: &'static str
) -> Result<Self, DecodeError>
Decodes non-null field and correctly propagates error.
The name
is used only for errors
Propagating errors with try!(decode()) is dangerous as it may propagate UnexpectedNull in the middle of an array, which user may think it's just null. try!(decode_field()) is safe
Implementors
impl<T: Decodable> Decode for T