Skip to main content

Crate id_effect_platform

Crate id_effect_platform 

Source
Expand description

Platform capabilities for id_effect — HTTP, filesystem, and process abstractions inspired by Effect.ts @effect/platform.

The crate ships one build: http, fs, process, and uri are always available.

§Example (HTTP, capability DI v2)

use id_effect::{RunError, run_with};
use id_effect_platform::http::{HttpRequest, execute, provide_reqwest_http_client};

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);

See the crate README.md and RFC 0001-id-effect-platform.md.

Re-exports§

pub use auth::MemoryOAuthClient;
pub use auth::MemorySessionStore;
pub use auth::OAuthClient;
pub use auth::OAuthError;
pub use auth::OAuthTokens;
pub use auth::OAuthUserInfo;
pub use auth::SessionData;
pub use auth::SessionError;
pub use auth::SessionStore;

Modules§

auth
Authentication capability traits (session store, OAuth client).
error
Structured errors for platform I/O (HttpError, FsError, ProcessError, PlatformError).
fs
Virtual filesystem (FileSystem): live Tokio (LiveFileSystem) and in-memory test double (TestFileSystem).
http
Portable HTTP client (HttpClient) and reqwest-backed ReqwestHttpClient.
process
Portable process spawning (ProcessRuntime) with Tokio implementation.
uri
HTTP URI helpers (http::Uri parse / build).