19 releases (8 breaking)

Uses new Rust 2024

0.8.0 Sep 13, 2025
0.6.5 Aug 23, 2025

#1012 in Asynchronous

Download history 180/week @ 2025-09-19 116/week @ 2025-09-26 129/week @ 2025-10-03 170/week @ 2025-10-10 134/week @ 2025-10-17 117/week @ 2025-10-24 98/week @ 2025-10-31 180/week @ 2025-11-07 268/week @ 2025-11-14 413/week @ 2025-11-21 450/week @ 2025-11-28 276/week @ 2025-12-05 274/week @ 2025-12-12 202/week @ 2025-12-19 174/week @ 2025-12-26 420/week @ 2026-01-02

1,101 downloads per month
Used in tcp-stream

BSD-2-Clause

55KB
1.5K SLoC

API Docs Build status Downloads Dependency Status LICENSE

A Rust async runtime abstration library.

Features

  • tokio: enable the tokio implementation (default)
  • smol: enable the smol implementation
  • async-global-executor: enable the async-global-executor implementation
  • async-io: enable the async-io reactor implementation

Example

use async_rs::{Runtime, TokioRuntime, traits::*};
use std::{io, time::Duration};

async fn get_a(rt: &TokioRuntime) -> io::Result<u32> {
    rt.spawn_blocking(|| Ok(12)).await
}

async fn get_b(rt: &TokioRuntime) -> io::Result<u32> {
    rt.spawn(async { Ok(30) }).await
}

async fn tokio_main(rt: &TokioRuntime) -> io::Result<()> {
    let a = get_a(rt).await?;
    let b = get_b(rt).await?;
    rt.sleep(Duration::from_millis(500)).await;
    assert_eq!(a + b, 42);
    Ok(())
}

fn main() -> io::Result<()> {
    let rt = Runtime::tokio()?;
    rt.block_on(tokio_main(&rt))
}

Dependencies

~2–20MB
~230K SLoC