turnloop
An embeddable event-loop driver for Rust. Your host owns the thread and calls
turn() to advance I/O, timers and cross-thread posts. Each turn returns
completions, makes at most one OS wait, and runs no user callbacks. There is no
runtime thread and no tokio dependency.
Pre-alpha. This workspace contains the Unix driver and runtime-independent PostgreSQL, MySQL, Redis, MongoDB and SMTP protocol engines. APIs can change. Protocol engines consume bytes and produce actions; host transport adapters are still being integrated. The optional local executor drives futures-io streams, sleep and timeout from host turns. Perry is the first intended consumer.
| Platform | Current implementation | Validation |
|---|---|---|
| macOS arm64 | kqueue, TCP/UDP/local IPC, stdio, processes, signals, TTY, timers and shared services | Native contracts, six allocation gates and executor tests |
| Linux x86_64 / arm64 | epoll, pidfd/SIGCHLD, native services, nanosecond waits and timerfd fallback | Cross-checked locally; native CI required |
| FreeBSD / Apple mobile / Android | Unix backend paths | Best effort; runtime validation pending |
| Windows x86_64 | Standalone IOCP spike | Cross-checked; production adapter and native contracts pending |
| WASI 0.2 / 0.3 | Standalone polling / component async spikes | Production adapters and shared contracts pending |
| Web | Standalone host-callback spike | Production adapter and browser contracts pending |
Windows and WASM are required for the first release; standalone spikes are excluded from the publishable workspace. The platform table describes current code, not a completed support promise. HTTP, TLS and WebSocket crates are being worked on separately.
use Duration;
use ;
let mut driver = new?;
let deadline = driver.now + from_millis;
driver.timer?;
let mut completions = default;
driver.turn?;
// Dispatch completions in the host's own event-loop phase.
# Ok::
Enable executor for LocalExecutor<B> and its futures-io adapters. Read/write
staging and task tables are reserved at construction. Writes are buffered; flush
or close before dropping an adapter to confirm underlying completion. The crate's
rustdoc includes runnable loop and executor examples. See the
revision 2 handoff
for native ownership, process teardown, platform integration and contract details.
Use the pinned nightly for dependency resolution under the seven-day publication soak. The workspace also builds with stable Rust 1.97.1.