Enum bip_bencode::Bencode [] [src]

pub enum Bencode<'a> {
    Int(i64),
    Bytes(&'a [u8]),
    List(Vec<Bencode<'a>>),
    Dict(BTreeMap<&'a strBencode<'a>>),
}

Bencode object that holds references to the underlying data.

Variants

Int(i64)

Bencode Integer.

Bytes(&'a [u8])

Bencode Bytes.

List(Vec<Bencode<'a>>)

Bencode List.

Dict(BTreeMap<&'a strBencode<'a>>)

Bencode Dictionary.

Methods

impl<'a> Bencode<'a>
[src]

fn decode(bytes: &'a [u8]) -> BencodeParseResult<Bencode<'a>>

fn encode(&self) -> Vec<u8>

fn kind<'b>(&'b self) -> BencodeKind<'b, 'a>

fn str(&self) -> Option<&'a str>

fn int(&self) -> Option<i64>

fn bytes(&self) -> Option<&'a [u8]>

fn list(&self) -> Option<&[Bencode<'a>]>

fn dict(&self) -> Option<&Dictionary<'a, Bencode<'a>>>

Trait Implementations

impl<'a> Hash for Bencode<'a>
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl<'a> Clone for Bencode<'a>
[src]

fn clone(&self) -> Bencode<'a>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<'a> PartialEq for Bencode<'a>
[src]

fn eq(&self, __arg_0: &Bencode<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Bencode<'a>) -> bool

This method tests for !=.

impl<'a> Eq for Bencode<'a>
[src]

impl<'a> Debug for Bencode<'a>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.