trpl-zh-cn/listings/ch13-functional-features/listing-13-18/src/main.rs
2022-02-06 16:43:51 +08:00

10 lines
190 B
Rust
Executable File

fn main() {
// ANCHOR: here
let v1: Vec<i32> = vec![1, 2, 3];
let v2: Vec<_> = v1.iter().map(|x| x + 1).collect();
assert_eq!(v2, vec![2, 3, 4]);
// ANCHOR_END: here
}