blob: 45519150eec2b560bd64d3e519cf39cd19add0b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// run-pass
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
fn main() {
let _generator = || {
let mut sub_generator = || {
yield 2;
};
match Pin::new(&mut sub_generator).resume(()) {
GeneratorState::Yielded(x) => {
yield x;
}
_ => panic!(),
};
};
}
|