3 releases

0.0.2 Aug 13, 2025
0.0.1 Nov 24, 2024
0.0.0 Oct 24, 2024

#825 in Asynchronous

Download history 8/week @ 2025-07-10 14/week @ 2025-07-17 5/week @ 2025-07-24 13/week @ 2025-07-31 38/week @ 2025-08-07 244/week @ 2025-08-14 161/week @ 2025-08-21 163/week @ 2025-08-28 43/week @ 2025-09-04 62/week @ 2025-09-11 18/week @ 2025-09-18 28/week @ 2025-09-25 69/week @ 2025-10-02 85/week @ 2025-10-09 55/week @ 2025-10-16 37/week @ 2025-10-23

255 downloads per month
Used in ohkami

MIT license

300KB
5K SLoC

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

Add the following dependency to your Cargo.toml:

[dependencies]
nio = "0.0.2"

Here is a basic echo server example:

use nio::net::TcpListener;
use std::io;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

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

        nio::spawn(async move {
            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();
            }
        });
    }
}

Dependencies

~3–17MB
~176K SLoC