Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
21 additions
and
0 deletions.
-
+21
−0
src/main.rs
|
@@ -110,7 +110,28 @@ fn string_iter() { |
|
|
for _ in s.chars() {} |
|
|
} |
|
|
|
|
|
fn iter_consumer() { |
|
|
let x = 1..99999; |
|
|
// I believe this is ``list(xrange(1, 99999))`` ..no? |
|
|
let _y = x.collect::<Vec<i32>>(); |
|
|
let x = 1..99999; |
|
|
let _y: Vec<i32> = x.collect(); // prettier |
|
|
} |
|
|
|
|
|
//fn f_ind() {} |
|
|
|
|
|
fn f_ilter() { |
|
|
let rng = 1..1000; |
|
|
let rng_even = rng.filter(|n| *n % 2 == 0) |
|
|
.collect::<Vec<i32>>(); |
|
|
for n in rng_even { |
|
|
assert!(n > 0); |
|
|
} |
|
|
} |
|
|
|
|
|
fn main() { |
|
|
f_ilter(); |
|
|
iter_consumer(); |
|
|
string_iter(); |
|
|
r_everse_iter(); |
|
|
o_ption(); |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.