sittard 0.1.0

Sans-IO tickless async runtime, fully deterministic
Documentation

Sittard - A Sans-IO tickless async runtime, fully deterministic.

That's a mouthful, so let's unpack it:

  • Async runtime: sittard runs async Rust code, i.e. stuff that implements the Future trait.
  • Sans-IO: sittard doesn't support asynchronous IO (e.g. network requests, filesystem operations, etc).
  • Tickless: sittard allows async code to "sleep", but instead of waiting for the time to elapse, sittard advances its virtual clock whenever necessary.
  • Fully deterministic: running the same code under sittard always yields the same results, unless the async code itself is a source of non-determinism.

Example

use sittard::Runtime;
use std::time::Duration;

// Create a runtime and run a future
let rt = Runtime::default();
rt.block_on(async move {
    let now = sittard::time::Instant::now();
    sittard::time::sleep(Duration::from_secs(60)).await;
    let elapsed_secs = now.elapsed().as_secs_f64();
    println!("Here we are, {elapsed_secs} seconds later...");
});

The code above completes instantly, even though it "sleeps" for 60 seconds.

Use Cases

Sittard is particularly useful for:

  • Creating reproducible simulations that depend on timing, e.g. QUIC network traffic with deep-space delays
  • Testing time-dependent code without waiting for real time to pass

Note that sittard is unsuitable for common async scenarios like web servers and clients.