Vendor things

This commit is contained in:
John Doty 2024-03-08 11:03:01 -08:00
parent 5deceec006
commit 977e3c17e5
19434 changed files with 10682014 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#![allow(deprecated)]
use generator::*;
fn xrange(start: u32, end: u32) -> u32 {
for i in start..end {
yield_with(i);
}
done!();
}
fn main() {
let g1 = Gn::new(|| xrange(0, 10));
let g2 = Gn::new(|| xrange(10, 20));
let g = Gn::new_scoped(|mut s| {
s.yield_from(g1);
s.yield_from(g2);
done!();
});
g.fold(0, |sum, x| {
println!("i={}, sum={}", x, sum + x);
sum + x
});
}