We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a02141 commit 37057e7Copy full SHA for 37057e7
src/libcollections/vec.rs
@@ -1296,7 +1296,18 @@ impl<T: PartialEq> Vec<T> {
1296
pub fn dedup(&mut self) {
1297
self.dedup_by(|a, b| a == b)
1298
}
1299
-
+
1300
+ /// Removes the first instance of `item` from the vector if the item exists.
1301
+ ///
1302
+ /// # Examples
1303
1304
+ /// ```
1305
+ /// let mut vec = vec![1, 2, 3, 1];
1306
1307
+ /// vec.remove_item(&1);
1308
1309
+ /// assert_eq!(vec, vec![2, 3, 1]);
1310
1311
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "38143")]
1312
pub fn remove_item(&mut self, item: &T) -> Option<T> {
1313
let pos = match self.iter().position(|x| *x == *item) {
0 commit comments