为Iterator特质对Generator的安全实现
Iterator
Generator
由uselessgoddess
#2528 in 算法
6KB 62 行
#![feature(generators, generator_trait)] use yield_iter::generator; fn main() { let x = 10; let iter = generator! { let r = &x; for i in 0..5u32 { yield i * *r } }; }
~0–265KB