pub fn add(&mut self, key: KeyType, value: ValueType) {
        match self.groups.entry(key) {
            Occupied(mut vec) => {
                vec.get_mut().push(value);
            }
            Vacant(slot) => {
                slot.insert(vec![value]);
            }
        }
    }
/// Adds `value to the group specified by `key`, creating a new group if necessary.
///
/// # Examples
///
/// ```
/// # use groupby::grouped_collection::*;
/// let mut coll = GroupedCollection::new();
/// coll.add("foo".to_string(), "foobarbaz".to_string());
/// coll.add("foo".to_string(), "foolish mortal".to_string());
/// let expected = vec!["foobarbaz".to_string(), "foolish mortal".to_string()];
/// assert_eq!(Some(&expected), coll.get(&"foo".to_string()));
/// ```
Adds `value to the group specified by `key`, creating a new group if necessary.
Adds ` value to the group specified by ` key ` creating a new group if necessary .
pub fn add(&mut self, key: KeyType, value: ValueType) {
        match self.groups.entry(key) {
            Occupied(mut vec) => {
                vec.get_mut().push(value);
            }
            Vacant(slot) => {
                slot.insert(vec![value]);
            }
        }
    }
pub fn add ( & mut self , key : KeyType , value : ValueType ) { match self . groups . entry ( key ) { Occupied ( mut vec ) => { vec . get_mut ( ) . push ( value ) ; } Vacant ( slot ) => { slot . insert ( vec ! [ value ] ) ; } } }
Adds `value to the group specified by `key`, creating a new group if necessary.
Adds ` value to the group specified by ` key ` creating a new group if necessary .
&mut self
key
KeyType
value
ValueType
&mut self
key
KeyType
value
ValueType
examples
None
use groupby::grouped_collection::*;
let mut coll = GroupedCollection::new();
coll.add("foo".to_string(), "foobarbaz".to_string());
coll.add("foo".to_string(), "foolish mortal".to_string());
let expected = vec!["foobarbaz".to_string(), "foolish mortal".to_string()];
assert_eq!(Some(&expected), coll.get(&"foo".to_string()));
```
let mut coll = GroupedCollection :: new () ; coll . add ( " foo " . to_string () " foobarbaz " . to_string () ) ; coll . add ( " foo " . to_string () " foolish mortal " . to_string () ) ; let expected = vec! [ " foobarbaz " . to_string () " foolish mortal " . to_string () ] ; assert_eq! ( Some ( &expected ) coll . get ( & " foo " . to_string () )) ; ` ` `