Add Asupersync to your Rust project and start building cancel-correct async systems.
Step 1
Add Asupersync with a single command.
$
cargo add asupersyncStep 2
A cancel-correct TCP server in under 25 lines.
examples/server.rs
01 asupersync::{Region, Cx, Outcome, Budget};02 std::time::Duration;03 04#[asupersync::main]05 main(cx: &Cx) -> Outcome<()> {06 // Open a region — all tasks scoped here07 Region::open(cx, "server", |cx| {08 // Spawn a listener with cancel capability09 permit = cx.spawn("listener", |cx| {10 listener = cx.tcp_bind("0.0.0.0:8080").?;11 {12 (stream, _) = listener.accept(cx).?;13 cx.spawn("conn", handle_connection(stream));14 }15 });16 17 // Wait for shutdown signal18 cx.shutdown_signal().;19 20 // Cancel with budget — tasks get 5s to drain21 permit.cancel(Budget::timeout(Duration::from_secs(5)));22 }).23}Syntax_Validation_Active
UTF-8_ENCODEDCore Concepts
The foundations of cancel-correct async programming.
Structured Concurrency
Every task lives in a Region. Regions form a tree. When a Region closes, all tasks within it are cancelled and awaited. No orphaned futures.
Cancel-Correctness
Three-phase protocol: Request → Drain → Finalize. Tasks always get time to clean up. Resources never leak. Buffers always flush.
Deterministic Testing
Lab runtime with seed-controlled execution. DPOR explores interleavings systematically. Replay any bug with the same seed.
FAQ
Answers to the most frequent questions about Asupersync.
When should I use Asupersync instead of Tokio?
Use Asupersync when correctness matters more than raw throughput. If you're building servers, pipelines, or systems where resource leaks, orphaned tasks, or silent cancellation failures would be bugs — Asupersync makes those bugs impossible by construction. Tokio is better for maximum single-server throughput where you're willing to handle cancellation safety manually.
Can I use Tokio crates with Asupersync?
Not directly — Asupersync uses its own runtime and async primitives. However, we provide bridge adapters for common Tokio ecosystem crates. The built-in protocol library covers most needs (TCP, HTTP, channels, mutexes) with cancel-correctness guarantees that Tokio wrappers can't provide.
How does performance compare to Tokio?
For I/O-bound workloads, Asupersync is within 5-15% of Tokio's throughput. The three-lane scheduler adds minimal overhead, and the cancel protocol only activates during actual cancellation. The Lab runtime (deterministic mode) is slower by design — it's for testing, not production.
Is Asupersync production-ready?
Asupersync is currently in v0.2.x — suitable for new projects and experimentation, but not yet battle-tested at scale. The core runtime has 12 formal proofs and extensive property-based testing. We recommend it for greenfield projects where you want correctness guarantees from day one.
What does 'cancel-correct' mean?
Cancel-correct means that when a task is cancelled, it always gets a chance to clean up (Drain phase), its finalizers always run (Finalize phase), and resources are never silently leaked. In Tokio, dropping a future just... stops it. Buffers may not flush. Connections may not close. Locks may not release. Asupersync makes this impossible.
How does the Lab runtime find bugs?
The Lab runtime uses Dynamic Partial Order Reduction (DPOR) to systematically explore task interleavings. Given a concurrent program, it identifies which interleavings produce different outcomes and tests a representative subset. This is far more effective than random testing — it can find bugs that might take billions of random runs to hit.
Do I need to learn a new async syntax?
No — Asupersync uses standard Rust async/await. The main difference is that your main function receives a Cx (capability context) parameter, and you use Region::open instead of bare task spawning. If you've used structured concurrency in Kotlin (coroutineScope) or Swift (TaskGroup), the patterns will feel familiar.
What's the minimum Rust version?
Asupersync requires Rust 1.75+ for async trait support and RPITIT. We track stable Rust and don't require nightly features.