#async-runtime #oxidizer #future #run-time

anyspawn

A generic task spawner compatible with any async runtime

3 releases (breaking)

Uses new Rust 2024

0.3.0 Mar 27, 2026
0.2.0 Mar 18, 2026
0.1.0 Jan 29, 2026

#2424 in Asynchronous


Used in cachet

MIT license

165KB
2K SLoC

Anyspawn Logo

Anyspawn

crate.io docs.rs MSRV CI Coverage License This crate was developed as part of the Oxidizer project

A generic task spawner compatible with any async runtime.

This crate provides a Spawner type that abstracts task spawning across different async runtimes without generic infection.

Design Philosophy

  • Concrete type: No generics needed in your code
  • Simple: Use built-in constructors or provide a closure
  • Flexible: Works with any async runtime

Quick Start

Using Tokio

use anyspawn::Spawner;

let spawner = Spawner::new_tokio();
let result = spawner.spawn(async { 1 + 1 }).await;
assert_eq!(result, 2);

Custom Runtime

use anyspawn::Spawner;

let spawner = Spawner::new_custom("threadpool", |fut| {
    std::thread::spawn(move || futures::executor::block_on(fut));
});

// Returns a JoinHandle that can be awaited or dropped
let handle = spawner.spawn(async { 42 });

Thread-Aware Support

Spawner implements ThreadAware and supports per-core isolation via Spawner::new_thread_aware, enabling contention-free, NUMA-friendly task dispatch. See the thread-aware section on Spawner for details and examples.

Features


This crate was developed as part of The Oxidizer Project. Browse this crate's source code.

Dependencies

~0.2–1.2MB
~21K SLoC