|
|
|
|
|
by Arnavion
708 days ago
|
|
Rust has had native generator syntax for a few years FYI. It's what async-await is built on. It's just gated behind a nightly feature. https://doc.rust-lang.org/stable/std/ops/trait.Coroutine.htm... and the syntax you're looking for for resuming with a value is `let res = yield ...` Alternatively there is a proc macro crate that transforms generator blocks into async blocks so that they work on stable, which is of course a round-about way of doing it, but it certainly works. |
|