Is there any other way of removing an element from the vector, other than finding the index of that element and using the remove method as like this :
let mut xs = vec![1,1,1,2,2,3];
let index = xs.iter().position(|x| *x == 1).unwrap();
xs.remove(index);
H2CO3
2
There are plenty of methods, depending on what exactly you want to do, e.g. retain()
, dedup_by_key()
…
system
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.