This is a custom target crate meant to handle extremely efficiency-consciouis and resource-frugal implementation of Rust std for embedded and performance-sensitive environments.
The build is for Linux, Windows, MacOS and WASM using strictly-async public APIs and enabling fully async implementations such as IOPC, io_uring and custom WASM host functions (as opposed to things like wasip1 for example).
The project is architected to be highly frugal and not targeting wide compatibility with existing crates as is as its goal.
The crate is meant to be used for projects that achieve cross-platform ultimate performance.
So that is what it is: a frugal, completion-based async platform layer for Linux, macOS, Windows, and WASM.
🩵🩵🩵🩵🟦🩵🟦🟦🩵🟦🟦🩵🟦🟦🟦🟦🟦🟦🟦🟦🩵🟦🩵🟦🩵🟦🩵🩵🩵🩵🩵🩵🩵⬜⬜⬜ 🩵🩶🩵🩶🩵🩵🩵🩶🟦🩵🟦🩵🟦🩵🩵🟦🩵🟦🩵🟦🩵🩵🟦🩵🩵🩵🩵🩵🩵🩵🩵⬜🩵🩵⬜⬜ 🩵🩵🩵🩵🩶🩵🩶🩵🩵🩵🩶🩵🩵🩶🩵🩵🟦🩶🟦🩵🟦🩵🩵🩶🩵🟦🩵🩶🩵🩶🩵🩵🩵⬜🩵⬜ 🩵⬜🩵⬜🩵⬜🩵🩵🩶🩵🩵🩶🩵🩵🩶🩵🩵🩵🟦🩵🩵🩵🩵🩵🩵🩵🩵🩵🩵🩵🩵🩵⬜🩵🩵⬜ 🩵🩵🩶🩵⬜🩵⬜🩵⬜🩵🩵🩵🩶🩵🩵🩶🩵🩶🩵🩶🩵🩶🩵🩶🩵🩶🩵🩵⬜🩵🩵🩵🩵🩵🩵🩶 🩵🩶🩵🩵🩵⬜🩵⬜🩵⬜🩵🩶🩵🩶🩵🩵🩵🩵🩵🩵🩵⬜🩵🩵⬜🩵⬜🩵🩵🩵⬜🩵🩵🩶🩶🟩 🩵🩵⬜🩵🩵🩵⬜🩵⬜🩵⬜🩵🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵🩵⬜🩵⬜🩵🩵🩵🩶🩶🟩🟫 ⬜🩵🩵⬜🩵⬜🩵🩵⬜🩵⬜⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜🩶🌊👖🟩 🩵⬜🩵⬜🩵🩵⬜🩵⬜🩵⬜🩵⬜⬜🩵⬜⬜🩵⬜⬜🩵⬜⬜🩵⬜⬜🩵⬜🩵⬜🩵🩵🩶🟩🟫🟩 ⬜🩵⬜🩵⬜🩵⬜🩵⬜🩵⬜⬜🩵⬜⬜⬜⬜⬜⬜🩵⬜⬜🩵⬜⬜🩵⬜🩵⬜🩵⬜🩵🩶🟫🟩🟫 🩵⬜⬜⬜⬜⬜🩵⬜🩵⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🩵🩶🟩🩶🟩 ⬜🩵🩵⬜🩵⬜⬜⬜⬜🩵⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🩶🩶🟫🩶🩶 🩵⬜🩵⬜🩵⬜🩵⬜⬜⬜🩵⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🩵⬜⬜🩵🩶🟩🟩🟫🟩 ⬜⬜⬜🩵⬜⬜⬜🩵⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🩶🩷🩷🩶🩶🟥🩷🟡⬜🩶🩶🩶🟩🩶🟩 🟩🩶🟩🟡🩶🩶🩵⬜⬜🩵⬜🩵🩶⬜⬜⬜⬜⬜⬜🟡🩶🩶🟡🩶🩶🩶🟡🟡🩶🌊🩷🟨🟡🩶🟫🟩 🟨🟩🟨🟩🩶🟡🩶🩶🩵⬜🩶🟩🩶🟩⬜⬜⬜⬜🩶🩶👖🟥🟨🩶🟫🟧🟨🟡🌊🟨🩶🩶🟥🩶🟩🟫 🟩🟧🟩🟨🟩🟡🟩🟨🟩🟩🩶🩶🟡🩶🟡🩶🟡🩶🩶👖🩶🟨🩶🟧🩶🟡🟡🟡👖🩷🟨🩶🟡🟨🩷🟩 🟩🟨🩶🩶🟡🟩🟡🩶🟫🟫🟩🟡🟩🩶🟩🟡🟩🟨🩶🟥🟨🟥🩶🟥🟧🟥🟡🟥🩷🩶🩶🟥🟡🟦🟡🩶 🩶🟩🟨🟩🟡🩶🟩🟨🟩🟡🩶🟩🟨🟩🟨🩶🟡🟪🟫🟨🟡🟨👖🟨🟡🟨🟡🟫🟧🟧🟧🩷🟡🟧🩶🩶 🟡🟩🟫🩶🟡🩶🟫🟩🟡🩶🟡🟡🟩🟨🩶🟡👖🟫🩶🟨🟩👖🟨🟩🟨🟡🟡🌊🩶🟧🩶🟥🟡🟨🟡🩶 🩶🟩🟨🟩🟡🟩🟨🟩🟫🟩🟩🟨🩶🟩🟨🟩🌊🟨🟨🟫🟧🟫🟥🟫🩶🟨🩶🟩🟨🟩🟫🟫🟡🟥🟧🟡 🟫🟩🟡🩶🟩🟨🩶🟡🟩🟨🟩🟩🟨🟩🟩🩶🟩🟧🟨🩶🟨👖🟨🟨🟨🟨🟫🟥🟫🟧🟩🩶🟡🟨🟥🟥 🟡🩶🟩🟨🟡🟡🟡🟩🟡🟡🟡🩶🟡🩶🟫🟩🟧🟫🟨🟫🟫🟨🟫🟨🟨🟧👖🟫🟡👖👖🟨🟡🟡🌊🟥 🟩🟫🩶🟡🟩🩶🟡🟡🩶🟩🟡🟩🟩🟨⚫🩶🟫🟩🟫🩶🩶🩶🟫🩶🟫🩶🟧🟨🟧🟧🩶🟨🟡🟡🟩🌊 🩶🟩🟡🟩🟡🟡🩶🟩🟡🟩🟨🩶🟩🟫🟩🟫🩶🩶🩶🩶🟡🩶🩶🩶🩶🟡🩶⬜🩶🩶🟧🟨🟨🟡🩶🟩 🟡🟡⚫⚫🟩🩶🟡⚫🟩🟨🟩🟫🟫🟩🟫🟫🩶🩶🩶🩶🩷⬜🟡🩷🟡⬜⬜⬜⬜⬜🟡🩶🟨🟡🩶🟡 🟡🟩🟩🟩🟩🟫🟡🟩🟨🩶🟩🟡🟩👖🟩👖🩶⚫🟫⚫🟫🩶🩶🩶🩷🩶🟡⬜⬜⬜⬜⬜🟡🟧🟨🟡 ⬜🟫🟫⚫🟩⚫🟡🟩🟡🩶🟡🟩🟫⬛⚫🟫🟫⚫⚫⚫⚫🟫🟧🩶🟫👖🟫👖🩶🩶🩶⬜⬜⬜🟫🟨 🟡🟩⬛⚫🟩🟡🟡⬜🟡🟡🟩🩶⚫⬛⚫🩶🟫👖⚫⚫⚫⚫🟫🟫🟫🫐🟫🟫🟫🟫🟫⚫🟫🟫🫐🟫 🟩🟩⚫🟫🟩🟡🟡⬜🟡🟡🟡🟩⬛⬛🟫🩶🟩🟫🟫⚫⚫⬛⚫🟫👖🟫👖🟫🌊🩶🩶🟫🟫🩶🩶🟫 🟡⬛⚫⚫🟩🩶🟡🟡🩶🟡🩶⚫⚫⬛🩶🩶🟫🩶🟫👖🟫🟫🩶🟫🩶🟫🟫🟫🟫🟫🩶🟫👖⬜🩶🟫 🩶⚫⚫🟩🟫🟩🟡🟩🟡⬜🟡⚫⬛⬛🟫🩶🩶🟫🩶🟫👖🩶⬜🟥🩶🩶🟫🩶🩶🩶🩶🟫🩶⬜🩶🟫 🟩🟫🟩🟩🟨🟡🩶🟡🟡🟡🟩🟩⚫⬛🟫🩶🟫🩶🟫🩶🟫⬜⬜⬜🟧⬜🩶🟧🩶🟡⬜🟫⬜🟡🩷🩶 🟡⚫🟩🟫🟩🟡🟡🟩🩶🟡🟡🟡🟩⬛⬛🟫⚫⚫⚫⚫🩶⬜⬜⬜🟫🩶⬜🩶🩷⬜🩶🩶⬜⬜🟡🩷 🟡🟡🟡🟡🟩🟫🩶🟡🟡🩶🟡🟩🟫⚫⚫🟩🩶🟧🟫🩶⬜⬜⬜⬜⬜🟫🟥🟫🟫🟧🩶🟡⬜⬜⬜⬜ 🟩🟡🟡🟡🟡🟩🟫🟩🟡🟡🟡🟡🟡🟡🟩🟡🩶🟫👖🟫🩶🟡⬜🩷🟡🩶🩶🩶⬜⬜⬜🩷⬜⬜⬜🟡 🟡🟡🟡⬜🟡🟡🟡🟡⬜🟡⬜⬜🟡⬜🟡🩶🩶🟫🩶🟫🟫🟫🩶🟫🩶🩷🟧🩶🟡⬜🟡⬜⬜⬜⬜🟡 ⬜🟡⬜🟡⬜🟡⬜🟡⬜🟡🟡⬜🟡⬜⬜🟡🩶🟫🩶⚫👖🟫🟫🩶🩷🟡🩶⬜⬜🩷⬜⬜⬜⬜⬜⬜ 🟡⬜🟡🟡⬜🟡⬜🟡⬜🟡⬜🟡⬜🟡🟡⬜🟫🟩🟫🟫🟫👖🟫🟫🩶⬜🟡⬜⬜🟡⬜⬜⬜⬜🟡⬜ 🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟡⬜🟡⬜🟡👖🟫👖🟫🫐🟫👖🟫🩶🟧🩶🩷⬜⬜⬜⬜⬜⬜⬜🟡 ⬜🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟡🟫⚫⚫🟫🟫🟫🟫🩶🟧🩶🩶🟨⬜⬜⬜⬜⬜🟡⬜⬜ 🟡⬜🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟡⬜🟡👖⚫🟫👖🟫👖🟫🩶🩶🟧🟫🩶⬜⬜⬜⬜⬜⬜🟡⬜ 🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟡⬜🟡🟫🟩🟫🩶🟡⬜⬜🟡⬜🟫🩶⬜🟡⬜⬜⬜⬜🟡⬜ 🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟡🟡⬜🟡🟡⬜🟡⬜🟫🩶🟧🩶🟡⬜⬜⬜🩶🟧⬜⬜⬜⬜🩵🩶⬜🟡 🟡🟡⬜🟡🟡⬜🟡🟡🟡🟡⬜🟡🟡🩶🟡🟩🟡⬜🩶👖🩶🩶🩷⬜⬜🟡🩶🩶⬜⬜⬜⬜⬜🟦⬜⬜ 🟡🟡🟡⬜🟡🟡⬜🟡⬜🟡🟡🩶🟡🟩🟡🟩🩶🩵🩶🩶🟫🩶🩶🩶🩶🩶🩶🟡⬜⬜⬜⬜🩵🩶⬜⬜ 🟡⬜🟡🟡🟡🟡🟡🟡🟡🟡🩶🟡🟩🟡🩶🩶⬜🩵🩶🩶🟩🟫🟫🩶🟫🩶🟡⬜⬜⬜⬜🩵🩵🩵⬜⬜ 🟡🟡⬜🟡⬜🟡⬜🟡⬜🟡🟡🟡🟩🩶🩵⬜🩵⬜🟦🩶🩶🩶🩶🩶🟡🩶⬜⬜🩵⬜🩵⬜⬜⬜⬜⬜ 🟡🟡🟡🟡🟡🟡🟡🟡🟡⬜🟡🟩🩶⬜🩵⬜🩵🩵🌊🩶🩶🟫🩶🩶🩶🩶🩶🩶🟦⬜⬜⬜⬜⬜⬜⬜ ⬜🟡⬜🟡⬜🟡⬜🟡🟩🟡🩶🟡⬜⬜🩵⬜🩶🩶🩶🩶🩶🩶⬜🩶🌊🩶🟦🩶🟦🩶⬜⬜⬜⬜⬜⬜ 🟡🟡🟡🟡🟡⬜🟡🟡⬜🟡🟩⬜🩵⬜🩵⬜🩵🩶⬜⬜🩶⬜🩶🌊🟦🩶🟦🩶🩵⬜⬜⬜⬜⬜⬜⬜ 🟡⬜🟡⬜🟡🟡🟡⬜🟡🟡⬜⬜🩵⬜🩵🩵🟦🩶⬜🌊⬜🩶🟦🩶🟦🩶🟦🩶🩶🩵⬜⬜⬜⬜⬜⬜ 🟡🟡🟡🟡⬜🟡⬜🟡🟡⬜⬜🩵⬜🩵⬜🩶🌊⬜🩶⬜🩵🟦🩶🩵🩶🟦🩶🟦🩵⬜⬜⬜⬜⬜⬜⬜ 🟡⬜🟡⬜🟡🟡🟡⬜🟡🟡⬜🩵⬜⬜🩵🟦🌊⬜🩶🟦🩵🩶🟦🟦🩵🩶🟦⬜⬜⬜⬜⬜⬜⬜⬜⬜ 🟡🟡🟡🟡🟡⬜🟡🟡⬜🟡⬜⬜🩵⬜⬜🌊🟦🩶⬜🟦🩶🟦🌊🌊🟦🟦🩶🩵⬜⬜⬜⬜⬜⬜🩶🩶 🟡⬜🟡⬜🟡🟡⬜🟡🟡🟡🩵⬜⬜🩵🟦🌊🩶🩵⬜🟦🩶🌊🟦🌊🩶🌊🩵⬜⬜⬜⬜⬜⬜🩶🩶🩶 🟡🟡🟡🟡🟡⬜🟡🟡⬜🟡⬜🩵⬜⬜🟦🟦🩵⬜🩵🩶🩵🟦🌊🟦🟦🟦⬜⬜⬜⬜⬜⬜🩶🩶🩶🩶 🟡⬜🟡⬜🟡🟡🟡🟡⬜🟡⬜⬜🩵🟦🌊⬜⬜⬜🩶🩵🟦🟦🩶🟦🩵🟦⬜⬜⬜⬜⬜🩶🩶🩶🩶🩶 🟡🟩🟡🟡🟡⬜🟡🟡🟡⬜⬜🩵⬜🟦⬜🩵⬜🩵🟦🩶🟦🩶🟦🌊🩶⬜⬜⬜⬜⬜🩶🩶🩶🩶🩶🩶 🟡🟡🟡⬜🟡🟡🟡⬜🟡🟡⬜⬜🩵⬜⬜⬜🩵🩶🟦🩵🟦🌊🩶🩵🩵⬜⬜⬜⬜🩶🩶🩶🩶🩶🌊🌊 🟡🟡🟡🟡🟡🩶🟡🟡⬜🟡🩵⬜🩵⬜🩵🩶🟦🩶🩵🩶🩶🟦🩵🩶🩵⬜⬜⬜🩶🩶🩶🩶🩶🩶🌊⬜ 🟡🩶🟡🩶🟡🟡🟡🟡🟡⬜⬜🩵⬜⬜⬜🩶🩶🟦🟦🩶🟦🩵🩶🩵⬜⬜⬜⬜🩶🩶🩶🩶🩶🩶🩶⬜ 🟡🟡🟡🟡🟡🟡⬜🟡⬜⬜🩵🩵⬜⬜⬜🟦🌊🩵🩵🩵🩶🩵🩶⬜⬜🩶🩶🩶🩶🩶🩶🩶🩶🩶⬜⬜ 🟡🟡🟡⬜🟡🟡🟡🟡🟡⬜⬜🩵⬜⬜⬜🩶🌊🌊🟦🩵🩶⬜🩵⬜🩶🩶⬜🩶🩶🩶🩶🩶🩶⬜⬜⬜ 🟡🟡🟩🟡🟡⬜🟡⬜🟡🩵🩵⬜⬜⬜⬜🩵🌊🌊🌊🩶🩵⬜🩵🩶🌊🩶🩶🩶🩶🩶🩶🩶⬜⬜⬜⬜ 🟡🟡🟡⬜🟡🟡🟡🟡🟡⬜⬜⬜⬜⬜⬜🩵🩶🌊🌊🌊🩵⬜🩶🌊🩶⚫🌊🩶🩶🩶🌊⬜⬜⬜⬜⬜ 🟡🟡🟡🟡🟡⬜🟡⬜🟡🩵🩵⬜⬜🩵⬜⬜🟦🌊🟦🌊👖🩶🩶🌊🫐🩶🫐🩶🩶👖🩵⬜⬜⬜⬜⬜ 🟡🟡⬜🟡🟡🟡🟡🟡⬜⬜🩵🩶🩵🩶⬜⬜🩶🌊🩶🟦🌊🌊🩶🌊🟩👖👖👖🌊🌊⬜⬜⬜⬜⬜⬜ 🟡🟡🟡🟡⬜🟡⬜🟡⬜🩵🟦🌊🟦🟦⬜⬜🟦🌊🌊🩶🌊🩶👖🩶🩶👖👖👖🟩🩶🩵⬜⬜⬜⬜⬜ 🟡🟡⬜🟡🟡🟡🟡🟡🟡🟦🌊🌊🟦🌊⬜⬜⬜🌊🌊🌊🟩👖🩶🟫🩶⚫🫐🌊🩶🩵🩶🩵⬜⬜⬜⬜ 🟡⬜🟡🟡⬜🟡🟡⬜🩶🩵🌊🟦🟦🟦⬜🩵🟦🟦🌊🩶🩶👖🩶🟩🌊👖🟩🩶🩵⬜🩶🩵🩶⬜⬜⬜ 🟡🟡🟡🟡🟡⬜🟡🟡⬜🟩🌊🌊🌊⬜⬜🩵🩶🌊🟩👖🩶🩶👖🩶🩶🌊🩶⬜🩵⬜🩵🩶🩵⬜🩵⬜ 🟡⬜🟡⬜🟡🟡🩶🟡🩵🩶🌊🌊🩶🩵⬜🩵🟦🩶👖🩶👖🟩🩶🩶🩶⬜🩵🩵⬜🩵⬜🩵🩶🩶⬜⬜ 🟡🟡🟡🟡⬜🟡🟡⬜⬜🩶🌊🌊🌊⬜⬜🩶🌊👖🩶👖🩶🟫🩶🩶⬜⬜⬜🩵⬜🩵⬜🩵🩵🩶🩵⬜ 🟡🩵🟡🟡🟡🟡⬜🟡🩵🩶🌊🌊🌊⬜⬜🌊🩶👖🟩🟫🌊🩶🩶🩵⬜⬜🩵🩶🩵🩶🩵⬜🩵⬜🩶🩵 🟡🟡🟩🟡⬜🟡🟡🟡🩵🩶🌊🌊🌊🩵🩶🌊👖🟩👖🌊🩶🌊⬜⬜⬜⬜🩵🩵🩶🩵⬜🩵⬜🩵🩵🩶 🟡🟡🟡🟡🟡🟡⬜🟩⬜🟦🌊🌊🩶🩶👖🟩🟫👖👖🟩🩶🩵🩵⬜⬜🩵⬜🩵🩶🩶🩶🩵🩶⬜🩵🩶 🟡🟩🟡🟩🟡⬜🟡🟡🩵🩶👮👖👮🫐👖👖🌊👖🩶👖🩶⬜⬜⬜⬜🩵🩶🩵🩵🩶🟦🩶🩵🩵⬜🩵 🟡🟩🟨🟩🟡🟡🟡🩶🩵🩶🌊🫐👖👖⚫🟩🟫🌊👖🌊🩶🩵⬜⬜⬜🩵⬜🩶🩵🩶🩵🩶🩶🩵⬜🩵 🟩🟫🟩🟨🟩🟡🩶🟡🩵🩶🌊👖⚫👖🫐👖👖🟩👮🌊🩵🩵⬜⬜🩵🩶🩵🩵🩶🩵🩶🟦🩶🩶🩵🩶
A minimal replacement for the async I/O portions of std, shaped like std but built on native completion APIs:
- Linux: io_uring (kernel 5.1+) with automatic epoll fallback for older kernels — selected at runtime, not at build time
- Windows: IOCP
- macOS: kqueue
- WASM: custom host function imports (not WASIP1)
| Module | Content |
|---|---|
io |
AsyncRead / AsyncWrite — one method each, Vec<u8> ownership transfer, no extension traits |
fs |
File, OpenOptions, DirReader, metadata |
process |
Command, Child, Stdio |
signal |
ctrl_c(), signal_wait() |
tty |
Terminal size/mode (sync); Tty implementing AsyncRead/AsyncWrite |
time |
sleep() (async), Instant::now() (sync) |
env |
get_args(), get_env() (sync) |
path |
Sync path utilities |
rt |
Completion registry and proactor driver; minimal single-threaded executor on native |
abi |
Overlapped struct and WASM host import declarations |
- No
tokio. Noasync-trait. No vtable-based platform abstraction. - No
flush/shutdownon base I/O traits — those belong on concrete types. - No extension traits in this crate — callers write their own loops.
AsyncRead::readandAsyncWrite::writetake and returnVec<u8>by value. The caller owns the buffer; the kernel borrows it for the duration of the operation.- Sync for: env, path, time (Instant), terminal control. Async for: all I/O.
rton WASM is a self-contained proactor (OverlappedFuture+ completion registry +tick()). On native it is a minimal single-threaded executor with its own proactor — no thread pinning, no cross-thread wakers.
Not a general async runtime. Not compatible with tokio traits. Not targeting broad ecosystem compatibility. Does not include networking, TLS, or any protocol-level code.
No external async or I/O dependencies. All OS bindings are extern "C" / extern "system" declarations against libraries the OS always provides:
- Linux:
syscall(2)for io_uring (syscall numbers 425/426/427 are stable kernel ABI, identical on glibc and musl); standard libc for epoll, signalfd, timerfd, fork, execve.#[repr(C)]struct definitions forio_uring_sqe/io_uring_cqe/epoll_eventinline — these are stable kernel ABI. - Windows:
extern "system" #[link(name = "kernel32")]for IOCP, file, and process APIs — always present, no install step. - macOS:
extern "C"againstlibSystem.dylibfor kqueue, kevent, and POSIX calls — always linked. - WASM:
extern "C" #[link(wasm_import_module)]host imports already inabi.rs.
All executor and scheduling logic is self-contained in rt/. Logic derived from compio-driver source is ported directly, not imported as a crate dependency.
Bootstrap step: generate the workspace sysroot output once with:
cargo run -p prebuildThis creates target/rusticated-spec/config.toml and the *-rusticated.json target specs under target/rusticated-spec/.
The workspace root also provides sysroot.toml, which includes the generated config and is the recommended wrapper for downstream builds.
Once prebuild has run, build consumer crates with:
cargo build -p <proj> --config sysroot.tomlor run them with:
cargo run -p <proj> --config sysroot.tomlNote that for Mohabbat smoke test build this is the right command:
go -C mohabbat-go run . && mohab.bat demo -o demo.bat && echo . | demo.bat
Or for full one liner end to end:
cargo run -p prebuild && go -C mohabbat-go run . && mohab.bat demo -o demo.bat && echo . | demo.bat
- Rust nightly toolchain (the repo's
rust-toolchain.tomlselects it automatically). wasm32-unknown-unknowntarget component — required to build the WASM demo binary:
rustup target add wasm32-unknown-unknown
- On Windows, if you do not have the MSVC linker installed, build explicitly with GNU instead:
```powershell
rustup toolchain install nightly-x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu --toolchain nightly-x86_64-pc-windows-gnu
cargo +nightly-x86_64-pc-windows-gnu run -p demo --target x86_64-pc-windows-gnu --config sysroot.toml
- Node.js ≥ 18 and its dependencies installed — required for the node-host and harness variants:
npm install --prefix node-host npm install --prefix harness
- **wasmtime** variant only: the `washmhost` crate bundles its own copy of the Wasmtime engine as a Cargo dependency; no separate install is needed.
## Building rusticated itself
`rusticated` is a library crate (`src/lib.rs`). It is built implicitly by `prebuild` as the custom sysroot implementation, and by consumer builds that depend on the generated target spec.
## Demo variant 1 — Native binary
The demo compiles directly to the host platform using `rusticated` as its `std` substitute.
```bash
cargo run -p demo --config sysroot.toml
On Windows, if you do not have the MSVC linker installed, build explicitly with GNU/LLVM instead:
rustup toolchain install nightly-x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu --toolchain nightly-x86_64-pc-windows-gnu
cargo +nightly-x86_64-pc-windows-gnu run -p demo --target x86_64-pc-windows-gnu --config sysroot.tomlThe executable reads from the terminal, waits up to 5 seconds for a line, then writes a small file and reads it back.
This variant compiles the demo to wasm32-rusticated-unknown-unknown and runs it through the washmhost Rust binary, which implements the rusticated ABI via Wasmtime's embedding API.
Step 1 — Build the WASM module (run once, or after changing demo/src/):
cargo build -p demo --target wasm32-rusticated-unknown-unknown --config sysroot.tomlThe .wasm output lands under target/wasm32-rusticated-unknown-unknown/debug/.
Step 2 — Run with the wasmtime host:
cargo run -p washmhost -- target/wasm32-rusticated-unknown-unknown/debug/demo.wasmSame WASM module, different host: a Node.js script (node-host/index.js) that implements the rusticated ABI over the WebAssembly JS API.
Build the WASM module as in Step 1 above (if not already done), then:
node node-host/index.js target/wasm32-rusticated-unknown-unknown/debug/demo.wasmThe harness spawns all three variants inside a ConPTY (via node-pty), types a few characters without pressing Enter, and lets the demo's built-in 5-second timer expire. It verifies that each variant exits cleanly (exit code 0) within 25 seconds.
node harness/index.js
To run a subset of variants:
node harness/index.js native
node harness/index.js wasmtime node
Results are written to harness-capture.md (overwritten each run). The terminal also prints a one-line summary:
Summary: native OK 6172ms wasmtime OK 6374ms node OK 6372ms
Based on a thorough review of the rusticated codebase, there are significant gaps. While the foundational loop and token registry are correctly modeled as a proactor (completion-based) system matching the WASM host logic, many actual OS-level I/O integrations are either completely stubbed out or relying on non-compliant fallbacks.
Here is an in-depth breakdown of the outstanding features and I/O implementations required to achieve parity across all platforms:
The event loop drivers are the bridges between Rust's Future model and the OS.
linux_uring.rs(Missing): As discussed, theio_uringbackend is entirely absent.epollacts via readiness (telling you when to read), but io.rs expressly declaresAsyncRead/AsyncWriteas an owned-buffer model (proactor). You needio_uringto natively pass buffer ownership to the kernel viaSQEand reap them viaCQE.- bsd.rs (Stubbed): macOS and FreeBSD currently use dead stubs. Requires
kqueue/keventintegration mappingEVFILT_READandEVFILT_WRITEto the token registry. - windows.rs (Overlapped OPs Missing): We just implemented the IOCP loop and handle registration, but we have not implemented the actual I/O operations (like
OverlappedBufferFuturefound inwasm.rs). You cannot do pure non-blocking file I/O on Windows via "readiness" polling; you must useReadFile/WriteFilepopulated with anOVERLAPPEDstructure, which currently does not exist for Windows in this tree.
The file system abstraction is exceptionally incomplete.
- Windows, macOS, BSD: Completely missing.
fs::Fileuses anative_stubmodule that immediately returnsio::Error::other("fs::File not yet implemented on this platform"). - Linux: Fundamentally flawed (Blocking). The Unix file abstraction currently drops down to raw
unsafe { read(self.fd, buf.as_mut_ptr(), ...) }bypassing the async loop entirely. File I/O on Linux is notoriously unsuited forepoll(local disks always report "ready"). You must either bridge this to the missinglinux_uring.rsor spawn a blocking threadpool. - General Missing Features: Missing directories (
DirBuilder,read_dir,remove_dir_all), metadata reading (metadata,symlink_metadata), and permission manipulations.
- Completely Missing: There is no
src/net.rspresent in the library. A functioning standard library replacement fundamentally requiresTcpListener,TcpStream, andUdpSocket. To support theAsyncRead/AsyncWriteownership model, these needWSARecv/WSASendwith IOCP on Windows, andio_uringorepoll+ non-blocking socket loops on Linux/macOS.
Child process tracking relies on blocking wait() methods unless special OS facilities are tapped.
- Linux: Functional. Seamlessly maps child PIDs to
pidfd_openand yields back toWaitReadableon theepollruntime. - Windows & macOS / BSD: Stubbed. Awaiting a process will immediately return
"Child::wait: async backend pending on this platform".- Windows Resolution: You need to call
RegisterWaitForSingleObjectto push the Process Handle onto the system thread pool and signal your IOCP Queue when it terminates. - macOS Resolution: Must be bridged to
kqueueusing theEVFILT_PROCfilter.
- Windows Resolution: You need to call
- Windows: Stubbed. Calling
ctrl_c()returns an error:"ctrl_c: Windows console-event backend pending". Resolution requires invokingSetConsoleCtrlHandlernatively and notifying the IOCP driver.
With all the above in mind we want to produce an executable that would be like a demo or a hello world inside rusticated for the demonstration of the rusticated facilities.
Themandate (non-negotiable) is to have an executable that depends visibly only on std, no overt sign of rusticated references anywhere. However it must be built on top of our custom rusticated as target. It should write to console (1), read single line input from console (2) check if that input resolves into a file and if so, read the last byte of that file and print it out (3).
NOTES:
rusticatedis a custom target, not a create to import. Its exports therefore are not imported from crates, but as the target std.
The repository now uses a generated workspace sysroot model.
Run the bootstrap step once:
cargo run -p prebuildThat produces:
target/rusticated-spec/config.tomltarget/rusticated-spec/<arch>-rusticated.json
The root sysroot.toml file includes the generated workspace config and is the supported wrapper for downstream consumer builds.
After prebuild, consumer crates are built with:
cargo build -p <proj> --config sysroot.tomlor run with:
cargo run -p <proj> --config sysroot.tomlFor the WASM host crate, washmhost/.cargo/config.toml already includes the generated target/rusticated-spec/config.toml.
The current workflow avoids manual std source substitution and uses the generated custom target specs and rustflags from target/rusticated-spec/.