|
|
|
|
|
by djmcnab
1380 days ago
|
|
Are you familiar with `core::other::from_fn`[1]. This allows converting from `impl FnMut() -> Option<T>` to `impl Iterator<Item = T>`. I recognise that these aren't strictly generators - you need to do your own state tracking. However, this does make it easier to do that ad-hoc. I believe there is some work in the ecosystem abusing `async` to make fake generators, although I haven't used any of them. [1]: https://doc.rust-lang.org/stable/core/iter/fn.from_fn.html |
|
Genawaiter[0] is one of them.
[0]: https://github.com/whatisaphone/genawaiter