#generator #iterator #yield

nightly yield-iter

Safe implementation of the Iterator trait for Generator

3 unstable releases

0.2.1 Jul 2, 2022
0.2.0 Jul 1, 2022
0.1.0 Jun 30, 2022

#20 in #yield

MIT license

6KB
62 lines

Safe implementation of the Iterator trait for Generator

Usage

#![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
        }
    };
}

Dependencies

~0–265KB