3 ms·
> It's best to treat 'await' as syntactic sugar, and to dig in to the underlying concepts. Slight word of warning: `async/await` is more than just sugar in Rus
by Argorak 7y ago
> It's best to treat 'await' as syntactic sugar, and to dig in to the underlying concepts.
Slight word of warning: `async/await` is more than just sugar in Rust, it also enables borrowing over awaits, which was previously not possible.
- MaxBarraclough 7y agoInteresting, thanks.
- Argorak 7y agoNerding a bit more, it was a bit late yesterday: this is why the Future takes this weird type called a `Pin`, which is a guarantee that the value does not move in memory while the Future is polled. This is also one of the reasons the feature took so long, Rust previously only had ways to detect potential moves in memory, but could not disallow them. https://doc.rust-lang.org/std/future/trait.Future.html#required-methods https://doc.rust-lang.org/std/future/trait.Future.html#requi...
- MaxBarraclough 7y agoInteresting ideas. I really must learn Rust properly.