3 releases (breaking)

Uses new Rust 2024

0.3.0 Jan 29, 2026
0.2.0 Jan 24, 2026
0.1.0 Nov 24, 2024

#12 in #nio

Download history 2/week @ 2026-01-21 55/week @ 2026-01-28 23/week @ 2026-02-04 1/week @ 2026-02-11 137/week @ 2026-02-18 29/week @ 2026-02-25 23/week @ 2026-03-04 59/week @ 2026-03-11 165/week @ 2026-03-18 54/week @ 2026-04-08

227 downloads per month
Used in 3 crates (via nio)

Apache-2.0

6KB
122 lines

Nio

Nio is an experimental async runtime for Rust. For more information, check out this article

Nio focuses solely on providing an async runtime, It doesn't include additional utilities like. io, sync, You'll still need to rely on libraries like tokio for everything else.

Example

Here is a basic echo server example:

use futures::AsyncWriteExt;
use nio::net::TcpListener;
use std::io::Result;

#[nio::main]
async fn main() -> Result<()> {
    let mut listener = TcpListener::bind("127.0.0.1:8080").await?;
    println!("{listener:#?}");

    loop {
        let conn = listener.accept().await?;
        println!("[INCOMING] {:?}", conn.peer_addr());

        let accept = || async {
            let mut stream = conn.connect().await?;
            let mut buf = vec![0; 1024];
            while let Ok(n) = stream.read(&mut buf).await {
                if n == 0 {
                    break;
                }
                stream.write_all(&buf[..n]).await.unwrap();
            }
            Result::Ok(())
        };
        nio::spawn_pinned(accept);
    }
}

Dependencies

~110–470KB
~11K SLoC