id_effect 0.2.0

Effect<A, E, R> (sync + async), context/layers, pipe — interpreter-style, no bundled executor
Documentation
1
2
3
4
5
6
7
8
9
10
//! Ex 045 — `check_interrupt` reads cancellation as an effect.
use id_effect::{CancellationToken, check_interrupt, run_blocking};

fn main() {
  let t = CancellationToken::new();
  assert_eq!(run_blocking(check_interrupt(&t), ()), Ok(false));
  t.cancel();
  assert_eq!(run_blocking(check_interrupt(&t), ()), Ok(true));
  println!("045_check_interrupt ok");
}