Expand description
Platform abstraction layer for clawft.
Provides traits for all platform-dependent operations (HTTP, filesystem, environment, process spawning) so the core engine can be platform-agnostic and WASM-compatible.
§Architecture
The Platform trait bundles all platform capabilities via accessor methods.
Each sub-capability has its own trait (http::HttpClient, fs::FileSystem,
env::Environment, process::ProcessSpawner) with a corresponding native
implementation.
ProcessSpawner is intentionally excluded from the
Platform bundle because it is unavailable in WASM environments. It is
accessible via Platform::process which returns Option.
§Example
use clawft_platform::{Platform, NativePlatform};
use clawft_platform::http::HttpClient;
use std::collections::HashMap;
let platform = NativePlatform::new();
let response = platform.http()
.get("https://example.com", &HashMap::new())
.await
.unwrap();
assert!(response.is_success());Modules§
- config_
loader - Configuration file discovery and loading.
- env
- Environment variable abstraction and native implementation.
- fs
- Filesystem abstraction and native implementation.
- http
- HTTP client abstraction and native implementation.
- process
- Process spawning abstraction and native implementation.
Structs§
- Native
Platform - Native platform implementation using std, tokio, and reqwest.
Traits§
- Platform
- Bundle of all platform capabilities.