Re:Await in Rust
by ClumsyPilot on Monday August 12, 2019 @10:26AM
(#20675685)
In C# you can't await an async in non-async function, but you can block until it's done. There is no drawback to having all code async.
[ Parent
| on HN ]
Re:Await in Rust
by TravHatesMe on Monday August 12, 2019 @10:47AM
(#20675873)
There is a drawback: it pollutes the signatures of each asynchronous method and the signatures of the consumers.
Each method now returns a Task, and each method name ought to have a suffix of 'Async'. It sucks that changing this will require all consumers to also modify their signatures as well. But I understand why it is necessary, the compiler needs to mark each 'step' in the asynchronous function to create a kind of state machine.
But it doesn't pollute the signatures of the consumers, that's the whole point of this subthread.
If you don't want/need to expose your async-ness, you just synchronously block on your async callees instead of awaiting them.