Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
16
third-party/vendor/generator/examples/range.rs
vendored
Normal file
16
third-party/vendor/generator/examples/range.rs
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use generator::{done, Gn};
|
||||
|
||||
fn main() {
|
||||
let n = 100000;
|
||||
let range = Gn::new_scoped(move |mut s| {
|
||||
let mut num = 0;
|
||||
while num < n {
|
||||
s.yield_(num);
|
||||
num += 1;
|
||||
}
|
||||
done!();
|
||||
});
|
||||
|
||||
let sum: usize = range.sum();
|
||||
println!("sum ={sum}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue