Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
👨🏻‍💻🚵🏻‍♂️

Matthias Einwag Matthias247

💭
👨🏻‍💻🚵🏻‍♂️
  • Vancouver BC, Canada
View GitHub Profile
@Matthias247
Matthias247 / a_case_for_cancellationtokens.md
Last active Jan 17, 2022
A case for CancellationTokens
View a_case_for_cancellationtokens.md

A case for CancellationTokens

Background

The Rust async working group is currently actively discusing on ways to improve async/await. Niko Matsakis documented the main goals and ideas in the async vision document.

As part of the improved async ecosytem, users should be able to make use of

View gist:fbdd66ae096cda2c7ca7848613d61d01
Channels (Single Threaded)/intrusive local channel with producers/5
time: [31.879 us 36.663 us 45.492 us]
Channels (Single Threaded)/intrusive local channel with producers/20
time: [25.602 us 25.952 us 26.363 us]
Channels (Single Threaded)/intrusive local channel with producers/100
time: [58.846 us 62.851 us 66.238 us]
Channels (Single Threaded)/intrusive channel with producers/5
time: [37.125 us 37.235 us 37.315 us]
Channels (Single Threaded)/intrusive channel with producers/20
@Matthias247
Matthias247 / async_await_cancellation.md
Created May 28, 2019
Async/Await - The challenges besides syntax - Cancellation
View async_await_cancellation.md

Async/Await - The challenges besides syntax - Cancellation

This is the second article in a series of articles around Rusts new async/await feature. The first article about interfaces can be found here.

In this part of the series we want to a look at a mechanism which behaves very different in Rust than in all other languages which feature async/await support. This mechanism is Cancellation.

@Matthias247
Matthias247 / async_await_interfaces.md
Last active Jan 24, 2022
# Async/Await - The challenges besides syntax
View async_await_interfaces.md

Async/Await - The challenges besides syntax

4 years after after the release of Rust 1.0, it seems like Rust is now finally getting close to getting support for async/await - a language feature which aims to make it easier to write programs in an asynchronous fashion (where multiple logical tasks get multiplexed on a lower number of OS threads).

One of the last steps before the feature is stabilized is choosing the best possible syntax. The discussions around syntax have triggered an enormous