id_effect 0.7.0

Effect<A, E, R>: lazy Send effects over a typed capability list, run on a fiber runtime (Tokio executor), with layers, streams, schedules and coordination
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Ex 008 — `effect!` reads a capability with `~Service`; `provide` supplies it.
use id_effect::{Effect, caps, effect};
use id_effect::{Exit, Never};

#[derive(Clone, Copy, PartialEq, Eq, Debug)]
struct Counter(pub i32);

fn program() -> Effect<i32, Never, caps!(Counter)> {
  effect!({ ~Counter.0 + 1 })
}

fn main() {
  assert_eq!(program().provide(Counter(41)).block_on(), Exit::succeed(42));
  println!("008_effect_macro_env ok");
}