📜  rust 过滤向量示例 - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:24.884000             🧑  作者: Mango

代码示例1
let numbers: Vec = vec![
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
];

let even_numbers = numbers
  .into_iter()
  .filter(|n| n % 2 == 0)
  .collect::>();

println!("{:?}", even_numbers);