3 ms·
This is possible pretty much with the syntax you wrote: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=da3b001b18caae2c91eaf4503c767d5b
by remram 5y ago
This is possible pretty much with the syntax you wrote: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=da3b001b18caae2c91eaf4503c767d5b https://play.rust-lang.org/?version=stable&mode=debug&editio...
Of course you need a runtime to drive that future forward, so it's more:
let result = runtime.block_on(future);
[edit: or if main() is async, I'm not sure if that's what you want to avoid: `let result = future.await;` https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=715b7fe32cf73132803237899d65afcc https://play.rust-lang.org/?version=stable&mode=debug&editio...]