add example to IndexMap.remove

This commit is contained in:
Jorge Aparicio 2018-04-23 19:43:57 +02:00
parent 15e654d0b5
commit f60ae0d3e0

View File

@ -638,6 +638,18 @@ where
/// Same as [`swap_remove`](struct.IndexMap.html#method.swap_remove)
///
/// Computes in **O(1)** time (average).
///
/// # Examples
///
/// ```
/// use heapless::FnvIndexMap;
/// use heapless::consts::*;
///
/// let mut map = FnvIndexMap::<_, _, U8>::new();
/// map.insert(1, "a").unwrap();
/// assert_eq!(map.remove(&1), Some("a"));
/// assert_eq!(map.remove(&1), None);
/// ```
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
where
K: Borrow<Q>,