Async-await on stable Rust!

Russel Winder russel at
Sun Nov 10 14:19:26 UTC 2019

On Sun, 2019-11-10 at 13:48 +0000, Paolo Invernizzi via Digitalmars-d wrote:
> On Sunday, 10 November 2019 at 12:10:00 UTC, rikki cattermole 
> wrote:
> > On 11/11/2019 12:56 AM, Russel Winder wrote:
> > > [...]
> > 
> > Okay, now this is a concept that interests me.
> > 
> > It hits a lot closer to what I would consider is a good event 
> > loop implementation, even if my existing designs are not 
> > complete enough for it.
> > 
> > Any more resources I should take a look at?
> Take a look here:
> There's also a D library inspired from that somewhere ...

There are lots of implementations of the official ReactiveX API managed by
this GitHub organisation:

The implementation of the reactive idea in gtk-rs is a specialised one since
the manager of the futures stream must integrate with the GTK event loop –
there is no event loop for the futures, it is fully integrated into the GTK+
event loop.

A real-world example. In D to receive events from other threads and process
them in the GTK+ thread I have to do:

    new Timeout(500, delegate bool() {
        (FrontendAppeared message) {
        (FrontendDisappeared message) {
        return true;

which is not very event driven and is messy – unless someone knows how to do
this better. Don't ask how to do this in C++ with gtkmm, you really do not
want to know.

With Rust:

    message_channel.attach(None, move |message| {
        match message {
            Message::FrontendAppeared{fei} => add_frontend(&c_w, &fei),
            Message::FrontendDisappeared{fei} => remove_frontend(&c_w, &fei),
            Message::TargettedKeystrokeReceived{tk} => process_targetted_keystroke(&c_w, &tk),

which abstract things far better, and in a way that is comprehensible and yet
hides the details.

The Rust implementation is handling more events since the D implementation is
now archived and all the work is happening on the Rust implementation.

Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Digitalmars-d mailing list