clawft-platform 0.1.1

Platform abstraction layer for clawft
Documentation

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;

# async fn example() {
let platform = NativePlatform::new();
let response = platform.http()
    .get("https://example.com", &HashMap::new())
    .await
    .unwrap();
assert!(response.is_success());
# }