Skip to content
Experimental cooperative cancellation for async-std
Branch: master
Clone or download
Latest commit d9cef9b Nov 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix channel capacity panic Nov 9, 2019
tests Fix a panic on TokenSource creation Nov 9, 2019
.gitignore initial Nov 3, 2019
Cargo.toml Switch to async-std 1.0 Nov 12, 2019 initial Nov 3, 2019

Cooperative cancellation for async-std.

Status: experimental.

See crate docs for details

use stop_token::StopToken;

async fn do_work(work: impl Stream<Item = Event>, stop_token: StopToken) {
    // The `work` stream will end early: as soon as `stop_token` is cancelled. 
    let mut work = stop_token.stop_stream(work);
    while let Some(event) = {
You can’t perform that action at this time.