📜  remove on condtion in vec rust - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:43.104000             🧑  作者: Mango

代码示例1
let mut vec = vec![1, 2, 3, 4];
vec.retain(|&x| x % 2 == 0);
assert_eq!(vec, [2, 4]);