1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! **Platform capabilities** for `id_effect` — HTTP, filesystem, and process abstractions
//! inspired by Effect.ts [`@effect/platform`](https://effect.website/docs/platform/introduction).
//!
//! The crate ships **one** build: [`http`], [`fs`], [`process`], and [`uri`] are always available.
//!
//! ## Example (HTTP, capability DI v2)
//!
//! ```ignore
//! use id_effect::{RunError, run_with};
//! use id_effect_platform::http::{HttpRequest, execute, provide_reqwest_http_client};
//!
//! # fn demo() -> Result<(), id_effect_platform::error::HttpError> {
//! let res = run_with(
//! [provide_reqwest_http_client()],
//! execute(HttpRequest::get("https://example.com")),
//! )
//! .map_err(|e| match e {
//! RunError::Effect(e) => e,
//! e => panic!("run failed: {e}"),
//! })?;
//! assert_eq!(res.status, 200);
//! # Ok(())
//! # }
//! ```
//!
//! See the crate [`README.md`](https://github.com/Industrial/id_effect/blob/main/crates/id_effect_platform/README.md)
//! and RFC [`0001-id-effect-platform.md`](../../docs/effect-ts-parity/rfcs/0001-id-effect-platform.md).
pub use ;