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 c80c31a commit 7cac5c9Copy full SHA for 7cac5c9
src/libcollections/vec.rs
@@ -1296,6 +1296,17 @@ impl<T: PartialEq> Vec<T> {
1296
pub fn dedup(&mut self) {
1297
self.dedup_by(|a, b| a == b)
1298
}
1299
+
1300
+ #[stable(feature = "rust1", since = "1.0.0")]
1301
+ pub fn remove_item(&mut self, item: &T) -> Option<usize> {
1302
+ let pos = match self.iter().position(|x| *x == *item) {
1303
+ Some(x) => x,
1304
+ None => return None,
1305
+ };
1306
1307
+ self.remove(pos);
1308
+ Some(pos)
1309
+ }
1310
1311
1312
////////////////////////////////////////////////////////////////////////////////
0 commit comments