[][src]Trait bencodex::codec::decode::Decode

pub trait Decode {
    pub fn decode(self) -> Result<BencodexValue, DecodeError>;
}

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);
Loading content...

Implementations on Foreign Types

impl Decode for Vec<u8>[src]

Loading content...

Implementors

Loading content...