Dedenne
Cute little generators!
Dedenne implements generators, a la the unstable language feature, over async/await in completely stable Rust.
Simple Usage
use *;
let mut generator = new;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
For a larger example, check out this simple TUI interface.
panic! vs unreachable!
If something in Dedenne panic!s, then it's a user error.
Make sure to await your y.ields, and don't call resume after a
generator's exhausted.
If something in Dedenne panics with an unreachable! message,
then it's a problem with Dedenne.
Please file a bug report if it does.
Prior Art
I am not the first person to have this idea. However, I think Dedenne is the only crate that supports mapping over iterators.
generator. Doesn't support a starting argument, which means you can't use it as a mapping iterator. Is always stackful.genawaiter. Has some convenience macros that make it nicer to make generators. Also lets you really tune how the generators are stored (stackful or allocating).- Unstable lang feature. Doesn't support passing values in to a generator, afaict. Also requires nightly rust and has been bikeshedding for 6 years as of time of writing.