From f60ae0d3e0bde890f87e1f1a400c65c802325967 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 23 Apr 2018 19:43:57 +0200 Subject: [PATCH] add example to IndexMap.remove --- src/indexmap.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/indexmap.rs b/src/indexmap.rs index 1ee5b018..6af98899 100644 --- a/src/indexmap.rs +++ b/src/indexmap.rs @@ -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(&mut self, key: &Q) -> Option where K: Borrow,