effectful 0.2.1

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
12
13
//! Ex 031 — a service value wraps itself in `ServiceContext`.
use effectful::Service;

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Service)]
struct Port {
  value: u16,
}

fn main() {
  let context = Port { value: 8080 }.to_context();
  assert_eq!(context.get::<Port>().map(|port| port.value), Some(8080));
  println!("031_service_constructor ok");
}