Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View likeabbas's full-sized avatar

Abbas Dharamsey likeabbas

  • @block.xyz
  • New York
View GitHub Profile
@likeabbas
likeabbas / cancel_from_outside.rs
Created August 14, 2021 21:47
Rust select! example to cancel from outside
let (send, recv) = oneshot::channel::<()>();
tokio::spawn(async {
tokio::select! {
_ = task_inner() => {},
_ = recv => {
info!("finished, break the loop, call it a day");
}
}