id_effect 0.1.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
11
//! Ex 041 — `ThreadSleepRuntime` blocks the OS thread for `sleep`.
use id_effect::{Runtime, ThreadSleepRuntime, run_blocking};
use std::time::Duration;

fn main() {
  let rt = ThreadSleepRuntime;
  let t0 = std::time::Instant::now();
  let _ = run_blocking(rt.sleep(Duration::from_millis(1)), ());
  assert!(t0.elapsed() >= Duration::from_millis(1));
  println!("041_thread_sleep_runtime ok");
}