Change README to use suspend()

fix #37
This commit is contained in:
Jonathan Soo 2016-09-01 08:36:08 -04:00 committed by edef
parent a60fcbfcdb
commit 2f143a18dc

View File

@ -42,7 +42,7 @@ use fringe::{OsStack, Generator};
fn main() {
let stack = OsStack::new(1 << 16).unwrap();
let mut gen = Generator::new(stack, move |yielder, ()| {
for i in 1..4 { yielder.generate(i) }
for i in 1..4 { yielder.suspend(i) }
});
println!("{:?}", gen.resume(())); // Some(1)
@ -74,7 +74,7 @@ fn main() {
let stack = OsStack::new(1 << 16).unwrap();
let mut gen = Generator::new(stack, move |yielder, mut index| {
let values = [1, 2, 3];
loop { index = yielder.generate(values[index]) }
loop { index = yielder.suspend(values[index]) }
});
println!("{:?}", gen.resume(5));