Type Definition sixarm_collections::btree_map_to_set::BTreeMapToSet[][src]

type BTreeMapToSet<K, V> = BTreeMap<K, BTreeSet<V>>;

Trait Implementations

impl<K, V> BTreeMapToSetExt<K, V> for BTreeMapToSet<K, V>[src]

fn sub_contains(&self, key: &K, value: &V) -> bool where
    K: Ord,
    V: Ord
[src]

Return true if the collection contains a sub-key-value item.

The value may be any borrowed form of the set’s value type, but [BTree] and Eq on the borrowed form must match those for the value type.

Examples

use sixarm_collections::*;
let mut a: BTreeMapToSet<u8, u8> = BTreeMapToSet::new();
a.sub_insert(1, 2);
assert_eq!(a.sub_contains(&1, &2), true);
assert_eq!(a.sub_contains(&3, &4), false);

fn sub_insert(&mut self, key: K, value: V) -> bool where
    K: Ord,
    V: Ord
[src]

Add a sub-key-value item to the collection.

Return whether the item is added in the set.

Examples

use sixarm_collections::*;
let mut a: BTreeMapToSet<u8, u8> = BTreeMapToSet::new();
a.sub_insert(1, 2);
assert_eq!(a.sub_contains(&1, &2), true);

fn sub_remove(&mut self, key: &K, value: &V) -> bool where
    K: Ord,
    V: Ord
[src]

Remove a sub-key-value pair from the collection.

Return whether the value was present in the set.

The value may be any borrowed form of the set’s value type, but Ord on the borrowed form must match those for the value type.

Examples

use sixarm_collections::*;
let mut a: BTreeMapToSet<u8, u8> = BTreeMapToSet::new();
a.sub_insert(1, 2);
assert_eq!(a.sub_contains(&1, &2), true);
a.sub_remove(&1, &2);
assert_eq!(a.sub_contains(&1, &2), false);