-
Notifications
You must be signed in to change notification settings - Fork 19
Comparing changes
Open a pull request
base repository: bytecodealliance/wstd
base: main
head repository: bytecodealliance/wstd
compare: p3
- 16 commits
- 65 files changed
- 2 contributors
Commits on Jun 9, 2026
-
Move wasip2 impl into src/sys/p2 (pure relocation)
This is a pure `git mv` relocation with no content changes, so git records clean renames and `git blame`/`--follow` lineage is preserved. The build is intentionally red after this commit; backend wiring and crate-root re-export shims are added in the following commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for cbd2a40 - Browse repository at this point
Copy the full SHA cbd2a40View commit details -
Wire up the src/sys backend with crate-root re-export shims
Restores a green build after the pure relocation. The crate root now selects a platform backend via a single cfg-if in src/sys/mod.rs, and each moved module is re-exported through a thin shim so the public API is preserved exactly: * add `mod sys` plus src/sys/mod.rs (cfg-if) and src/sys/p2/mod.rs * add crate-root shims: http.rs, net.rs, rand.rs, runtime.rs, time.rs * re-export the moved stdio/streams via src/sys/p2/io and io/mod.rs * repoint the few internal `super::`/private-module paths the move broke * add the cfg-if dependency Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 19f2f24 - Browse repository at this point
Copy the full SHA 19f2f24View commit details -
Document the backend contract and assert it at compile time
Spell out, in `src/sys/mod.rs`, the duck-typed contract each `src/sys` backend must satisfy so the crate-root modules can be target-agnostic facades. Add a private `const _` block that statically checks the parts the facades depend on (the IO stream traits today), so backend drift fails fast with a clear message instead of surfacing deep inside a facade. No behavior or public-API change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 5d4f2c5 - Browse repository at this point
Copy the full SHA 5d4f2c5View commit details -
Turn
timeinto a cfg-free facade over a small clock contractPromote the portable time types — `Duration`, `Instant`, `Interval`, `interval`, `Timer`, `Wait`, and the crate-internal `utils::timeout_err` — out of the wasip2 backend and into the `crate::time` facade, where they are written once with no `#[cfg]` and own all of their own arithmetic. The wasip2 backend (`src/sys/p2/time`) keeps only the primitives that genuinely depend on the WASI 0.2 clocks: the `MonotonicInstant` / `MonotonicDuration` nanosecond aliases, `now`, `SystemTime`, and a `Sleep` future built by `sleep_until`. `Timer` now records its deadline at construction (`TimerKind::{Never, At}`) and builds a fresh backend `Sleep` on each `wait`, so a second backend (p3) only has to supply a different `Sleep`/`sleep_until` rather than re-implementing the facade. Extend the backend-contract assertions in `src/sys/mod.rs` accordingly. Public API is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Configuration menu - View commit details
-
Copy full SHA for 0c6bca1 - Browse repository at this point
Copy the full SHA 0c6bca1View commit details -
Hoist the portable
randsurface into a facadeThe length guard and slice copy in `get_random_bytes` / `get_insecure_random_bytes` are identical across backends; only the host RNG call differs. Move the two public functions up into the `crate::rand` facade and reduce the wasip2 backend to `random_bytes` / `insecure_random_bytes` primitives that return the raw bytes. Public API is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 5428a40 - Browse repository at this point
Copy the full SHA 5428a40View commit details -
Hoist the portable runtime executor surface into a facade
`spawn` and the `async_task::Task` re-export are identical across backends; only `block_on` and the `Reactor` internals are platform specific. Move `spawn` and `Task` up into the `crate::runtime` facade and re-export `block_on`/`Reactor`/`AsyncPollable`/`WaitFor` from the wasip2 backend. `REACTOR` and `Reactor` stay in the backend. Public API is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for e030a6a - Browse repository at this point
Copy the full SHA e030a6aView commit details -
Hoist the portable http surface into a facade
Convert `src/http.rs` from a blanket `pub use crate::sys::http::*` shim into a real facade: it owns the portable surface (`StatusCode`, `Uri`/`Authority`/ `PathAndQuery`, the `error` module of `anyhow`/`http`-crate error types, and the `body`/`request`/`response`/`server` public submodule paths) and re-exports the backend's concrete types (`Client`, `Method`, `Scheme`, `HeaderMap`, `Body`, ...) through `crate::sys::http::*`. This keeps every public path identical while moving the target-agnostic shape out of the backend, so a future p3 backend only has to supply the platform pieces. The backend `sys::p2::http` now exposes just the platform impl: submodules with `pub`/`pub(crate)` visibility plus `pub use wasip2::http::types::{ErrorCode, HeaderError}`. Its impl files import the public error/value types from the facade (`crate::http::*`) instead of the removed backend-level re-exports, and the public `server` module doc moves up to the facade. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Configuration menu - View commit details
-
Copy full SHA for 1e978e1 - Browse repository at this point
Copy the full SHA 1e978e1View commit details
Commits on Jul 3, 2026
-
Turn net into a facade that delegates to the backend
`src/net.rs` was a blanket `pub use crate::sys::net::*`. Make it a real facade: declare the crate's public network surface -- `TcpStream`, `TcpListener`, `ReadHalf`, `WriteHalf`, `Incoming` -- as thin wrappers at the crate root that delegate every operation to the selected backend's implementation under `crate::sys::net`. The one genuinely portable piece, `TcpStream::connect`'s `ToSocketAddrs` resolve-and-retry loop, is written once here against the backend's `connect_addr` primitive (removed from the backend), so a second backend inherits it for free. Socket-shutdown cleanup still runs through the inner backend handles' own `Drop`; the facade keeps explicit `Drop` impls so the public drop contract is unchanged. Public API is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for efeaeea - Browse repository at this point
Copy the full SHA efeaeeaView commit details -
Merge remote-tracking branch 'origin/main' into yoshuawuyts/yoshuawuy…
…ts-move-p2-impl-to-sys
Configuration menu - View commit details
-
Copy full SHA for da219b9 - Browse repository at this point
Copy the full SHA da219b9View commit details -
Target CI at wasm32-wasip2 for the wasip2-only crates
Now that `wstd` and `wstd-axum` only compile for `wasm32-wasip2` (the `sys` backend is cfg-gated and other targets hit `compile_error!`), the CI steps that built them for the host target fail to resolve `crate::sys::*`. Scope those steps to the target: - `check` and `Clippy` build `wstd`/`wstd-axum` with `--target wasm32-wasip2 --all-targets` and keep the `test-programs` host harness on the host. - `Docs` builds with `--target wasm32-wasip2`. - `ci/publish.rs` passes `--target wasm32-wasip2` when packaging `wstd` and `wstd-axum`. `--all-targets` newly lints the `#[cfg(test)]` code, so regroup the digit literals in the `time` duration tests to satisfy `inconsistent_digit_grouping`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 1200707 - Browse repository at this point
Copy the full SHA 1200707View commit details
Commits on Jul 19, 2026
-
Configuration menu - View commit details
-
Copy full SHA for b3f4c06 - Browse repository at this point
Copy the full SHA b3f4c06View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8aeb515 - Browse repository at this point
Copy the full SHA 8aeb515View commit details -
fix p3 example compilation and wstd-axum json feature
Resolve the test failures introduced by the p2/p3 refactor: - wstd-axum: add a `json` feature (enabled by default) that turns on `wstd/json`. The switch to `default-features = false` had dropped json, breaking the weather example's `Body::json()`. - p3 time: make `Wait` hold a `Send` future so streaming response bodies (which await `task::sleep`) satisfy `Body::from_try_stream`'s `Send` bound. Fixes the `http_server` example under wasip3. - p3 net: give `TcpStream`/`TcpListener` interior mutability so they expose the same shared-reference API as p2 (`io::copy(&stream, &stream)`, `incoming(&self)`), add `TcpStream::peer_addr`, and replace the unsound raw-pointer `split` with safe shared references. Fixes the `tcp_echo_server` example under wasip3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 539fa50 - Browse repository at this point
Copy the full SHA 539fa50View commit details -
p3: async-lift
wasi:cli/runfor#[wstd::main]instead of block_onUnder WASIp3 a synchronous `wasi:cli/run` task cannot block on async-lowered imports: `block_on` (driven by `waitable-set.wait`) traps with "cannot block a synchronous task before returning". So `block_on` stays a p2-only concept. For p3, `#[wstd::main]` now async-lifts the export the same way `#[wstd::http_server]` does: it implements the async `wasi:cli/run` guest directly and exports it via `wasip3::cli::command::export!`, so the body can `.await` async-lowered imports (timers, sockets, http) without trapping. The bin's `fn main` remains as a dead entry point. The proc macro now delegates to a cfg-split `__main_export!` declarative macro in wstd (p2 keeps block_on; p3 async-lifts), mirroring `__http_server_export!`, so the `wstd_p2`/`wstd_p3` cfg aliases are evaluated in wstd's context for downstream consumers. A `__MainReturn` helper maps `()` / `Result<(), E: Debug>` to the `Result<(), ()>` the export requires, printing errors to stderr on failure. Also apply a pending rustfmt fix to src/sys/p3/io.rs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 889ec7b - Browse repository at this point
Copy the full SHA 889ec7bView commit details -
adapt p3 backend to modular facades
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for be2d331 - Browse repository at this point
Copy the full SHA be2d331View commit details -
Configuration menu - View commit details
-
Copy full SHA for c6232ea - Browse repository at this point
Copy the full SHA c6232eaView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...p3