Skip to content

async-rs/stop-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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) = work.next().await { process_event(event).await } }

About

Experimental cooperative cancellation for async-std

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages