[−][src]Trait bencodex::codec::decode::Decode
Decode is a trait to decode a Bencodex value.
Required methods
pub fn decode(self) -> Result<BencodexValue, DecodeError>[src]
Decodes a Bencodex value to return from this type.
If decoding succeeds, return the value inside Ok. Otherwise, return the DecodeError inside Err.
Examples
Basic usage with Vec<u8>, the default implementor which implements Decode.
use bencodex::{ Decode, BencodexValue }; let vec = vec![b'n']; let null = vec.decode().unwrap(); assert_eq!(BencodexValue::Null(()), null);