Async-await on stable Rust!

Heromyth bitworld at qq.com
Sat Nov 9 07:32:17 UTC 2019


On Friday, 8 November 2019 at 02:04:07 UTC, Heromyth wrote:
> See 
> https://blog.rust-lang.org/2019/11/07/Async-await-stable.html.

Here are two projects about this:
https://github.com/evenex/future
http://code.dlang.org/packages/dpromise

I make some improvements based on them.  Here is an example:

  void test05_03() {
         auto ex5a = tuple(3, 2)[].async!((int x, int y) {
             Promise!void p = delayAsync(5.seconds);
             await(p);
             return to!string(x * y);
         });

         assert(ex5a.isPending); // true

         auto r = await(ex5a);
         assert(r == "6");
     }


More information about the Digitalmars-d mailing list