pub fn insert(&mut self, key: K, value: V) -> Option<V>
    where
        K: Ord,
    {
        let mut ent = self.entry(key);
        if let Some(val_mut) = ent.get_mut() {
            let mut ret = value;
            core::mem::swap(val_mut, &mut ret);
            Some(ret)
        } else {
            ent.or_insert(value);
            None
        }
    }
/// Inserts a key-value pair into the map.
///
/// If the map didn't have this key present, `None` is returned.
///
/// If it did, the key is not updated, and the old value is replaced with the new one and
/// returned.
///
/// # Examples
///
/// ```
/// use bptree::BpTreeMap;
///
/// let mut map = BpTreeMap::new();
/// assert_eq!(map.insert(1, "One"), None);
/// assert_eq!(map.len(), 1);
///
/// assert_eq!(map.insert(1, "Another"), Some("One"));
/// assert_eq!(map.get(&1), Some(&"Another"));
/// assert_eq!(map.len(), 1);
/// ```
Inserts a key-value pair into the map.
If the map didn't have this key present, `None` is returned.

If it did, the key is not updated, and the old value is replaced with the new one and
returned.
Inserts a key - value pair into the map . If the map didn ' t have this key present ` None ` is returned . If it did the key is not updated and the old value is replaced with the new one and returned .
pub fn insert(&mut self, key: K, value: V) -> Option<V>
    where
        K: Ord,
    {
        let mut ent = self.entry(key);
        if let Some(val_mut) = ent.get_mut() {
            let mut ret = value;
            core::mem::swap(val_mut, &mut ret);
            Some(ret)
        } else {
            ent.or_insert(value);
            None
        }
    }
pub fn insert ( & mut self , key : K , value : V ) -> Option < V > where K : Ord , { let mut ent = self . entry ( key ) ; if let Some ( val_mut ) = ent . get_mut ( ) { let mut ret = value ; core :: mem :: swap ( val_mut , & mut ret ) ; Some ( ret ) } else { ent . or_insert ( value ) ; None } }
Inserts a key-value pair into the map.
Inserts a key - value pair into the map .
&mut self
key
K
value
V
&mut self
key
K
value
V
examples
```
use bptree::BpTreeMap.

let mut map = BpTreeMap::new();
assert_eq!(map.insert(1, "One"), None);
assert_eq!(map.len(), 1).


` ` ` use bptree :: BpTreeMap . let mut map = BpTreeMap :: new () ; assert_eq! ( map . insert ( 1 " One " ) None ) ; assert_eq! ( map . len () 1 ) .