Trait bip_bencode::Dictionary [] [src]

pub trait Dictionary<'a, V> {
    fn to_list(&self) -> Vec<(&'a str, &V)>;
    fn lookup(&self, key: &str) -> Option<&V>;
    fn lookup_mut(&mut self, key: &str) -> Option<&mut V>;
    fn insert(&mut self, key: &'a str, value: V) -> Option<V>;
    fn remove(&mut self, key: &str) -> Option<V>;
}

Trait for working with generic map data structures.

Required Methods

fn to_list(&self) -> Vec<(&'a str, &V)>

Convert the dictionary to an unordered list of key/value pairs.

fn lookup(&self, key: &str) -> Option<&V>

Lookup a value in the dictionary.

fn lookup_mut(&mut self, key: &str) -> Option<&mut V>

Lookup a mutable value in the dictionary.

fn insert(&mut self, key: &'a str, value: V) -> Option<V>

Insert a key/value pair into the dictionary.

fn remove(&mut self, key: &str) -> Option<V>

Remove a value from the dictionary and return it.

Implementors