| Crates.io | luminal_rt |
| lib.rs | luminal_rt |
| version | 0.3.0 |
| created_at | 2025-09-11 03:30:16.342459+00 |
| updated_at | 2025-09-13 02:05:33.031067+00 |
| description | A DLL-boundary safe async runtime with tokio-compatible API |
| homepage | |
| repository | https://github.com/tristanpoland/luminal |
| max_upload_size | |
| id | 1833287 |
| size | 961,282 |
Luminal is a high-performance async runtime designed to solve tokio's DLL boundary issues while maintaining similar performance and API compatibility.

spawn, block_on, and JoinHandleAdd Luminal to your Cargo.toml:
[dependencies]
luminal = "0.1.0"
use luminal::Runtime;
async fn hello_world() {
println!("Hello, world!");
}
fn main() {
let rt = Runtime::new().unwrap();
let rt_clone = rt.clone();
rt.block_on(async move {
rt_clone.spawn(hello_world()).await;
});
}
use luminal::Runtime;
fn main() {
let rt = Runtime::new().unwrap();
rt.block_on(async {
println!("Running on Luminal runtime!");
});
}
Unlike tokio, which uses thread-local storage for its runtime context, Luminal uses explicit context passing. This makes it safe to use across DLL boundaries:
// Inside a DLL
fn dll_function(runtime: luminal::Runtime) -> u32 {
// Safe to use the runtime passed from outside
runtime.block_on(async { 42 })
}
// From the main application
fn main() {
let rt = luminal::Runtime::new().unwrap();
let result = dll_function(rt.clone());
assert_eq!(result, 42);
}
The central coordination point for the Luminal async runtime:
// Create a new runtime
let rt = Runtime::new().unwrap();
// Spawn a task and get a JoinHandle
let handle = rt.spawn(async { 42 });
// Block and wait for a future to complete
let result = rt.block_on(handle);
// Get a handle to the runtime
let handle = rt.handle();
// Check runtime stats (queue length and processed tasks)
let (queue_len, tasks_processed) = rt.stats();
A lightweight handle to a Runtime:
// Get a handle from an existing runtime
let handle = rt.handle();
// Spawn tasks using the handle
let task = handle.spawn(async { 42 });
// Block on futures using the handle
let result = handle.block_on(task);
For convenience, Luminal also provides global functions (though these use thread-local storage):
use luminal::{spawn, block_on};
// Spawn a task on the current thread's runtime
let handle = spawn(async { 42 });
// Block on a future using the current thread's runtime
let result = block_on(handle);
Luminal includes comprehensive benchmark suites for:
Run benchmarks with:
cargo run --release
Run the test suite with:
cargo test
This project is licensed under the MIT License - see the LICENSE file for details.