1
0
Fork 0
This commit is contained in:
Alex Kotov 2020-11-17 08:15:02 +05:00
parent e16855e607
commit f95cd273d3
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 13 additions and 0 deletions

1
2-map-in-rust/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/main

5
2-map-in-rust/Makefile Normal file
View File

@ -0,0 +1,5 @@
all: main
./main
main: main.rs
rustc main.rs

7
2-map-in-rust/main.rs Normal file
View File

@ -0,0 +1,7 @@
fn main() {
let a: Vec<u32> = (0..10).collect();
let b: Vec<(u32, u32)> = a.iter().map(|&n| (n, n.pow(2))).collect();
for (n, nn) in b {
println!("{}: {}", n, nn);
}
}