Expand description
Vixitic — a deterministic tick-reactor async runtime.
async in Rust is a compiler state machine plus a Waker contract: “am I
done? no? call this when I should re-check.” Tokio answers “who calls the
waker” with an OS reactor (epoll/IOCP). Vixitic answers it with your integer
clock: a task wakes on the exact tick your simulation says it should, never
on a socket, a thread scheduler, or a wall clock.
That makes every resume a pure function of (condition, event schedule),
which is what lockstep netcode, rollback, emulators and replayable
simulations actually need. Two runs of the same schedule produce a
byte-identical resume log — see tests/integration.rs.
Two primitives, nothing else:
Runtime— a loop draining a run-queue of tasks. Driven whole (Runtime::block_on) or one tick at a time (Runtime::step, where an external metronome IS the clock).Reactor— parks(Cond, Waker)pairs;Reactor::advancereturns the wakers whose condition the tick satisfies. Your engine feeds it.
use vixitic::{sleep_ticks, spawn, Runtime};
let rt = Runtime::new();
let woke = rt.block_on(
async {
spawn(async { sleep_ticks(3).await; });
sleep_ticks(5).await
},
|_tick| Vec::new(), // no external events this run
10, // hang-guard: panic rather than spin forever
);
assert_eq!(woke, 5);Zero dependencies, std only.
Structs§
- Await
- The future returned by
await_event/sleep_ticks. Resolves to the tick it was woken on. - Reactor
- Binds wakers to integer clock events. Single-writer, driven by your engine.
- Runtime
- The Vixio runtime: drain the run-queue, advance the integer clock, repeat.
Enums§
- Cond
- What a parked task is waiting for.
Functions§
- await_
event - Park until the engine fires event
id. Resumes on the exact integer tick the engine reported it. - sleep_
ticks - Park for
nticks of the integer clock, relative to now. - spawn
- Spawn a child task onto the current runtime. Fire-and-forget: the handle is not returned, so a child that outlives the root is simply dropped.