An io_uring backed runtime for Rust
Find a file
2024-12-11 17:26:51 +01:00
.cargo chore: fix race of fs unit tests (#121) 2022-09-28 10:09:24 -05:00
.github/workflows chore: update actions/checkout action to v4 (#290) 2024-01-08 10:18:39 +00:00
benches idfk 2024-12-09 03:24:35 +01:00
examples chore: ignore unhelpful lint (#301) 2024-05-27 16:04:34 -05:00
src bit more apis 2024-12-11 17:26:51 +01:00
tests adjustments 2024-12-10 20:31:23 +01:00
.gitignore Initial commit 2021-03-30 10:48:41 -07:00
Cargo.toml works with sqpoll 2024-12-10 19:56:17 +01:00
CHANGELOG.md chore: prepare tokio-uring v0.4.0 (#166) 2022-11-05 16:09:54 -05:00
DESIGN.md chore: Tokio-uring design proposal (#1) 2022-08-09 14:33:48 -05:00
LICENSE Initial commit 2021-03-30 10:48:41 -07:00
README.md chore: prepare v0.5.0 (#300) 2024-05-27 16:22:19 -05:00

tokio-uring

This crate provides io-uring for Tokio by exposing a new Runtime that is compatible with Tokio but also can drive io-uring-backed resources. Any library that works with Tokio also works with tokio-uring. The crate provides new resource types that work with io-uring.

API Docs | Chat

Getting started

Using tokio-uring requires starting a [tokio-uring] runtime. This runtime internally manages the main Tokio runtime and a io-uring driver.

In your Cargo.toml:

[dependencies]
tokio-uring = { version = "0.5.0" }

In your main.rs:

use tokio_uring::fs::File;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    tokio_uring::start(async {
        // Open a file
        let file = File::open("hello.txt").await?;

        let buf = vec![0; 4096];
        // Read some data, the buffer is passed by ownership and
        // submitted to the kernel. When the operation completes,
        // we get the buffer back.
        let (res, buf) = file.read_at(buf, 0).await;
        let n = res?;

        // Display the contents
        println!("{:?}", &buf[..n]);

        Ok(())
    })
}

Requirements

tokio-uring requires a very recent linux kernel. (Not even all kernels with io_uring support will work) In particular 5.4.0 does not work (This is standard on Ubuntu 20.4). However 5.11.0 (the ubuntu hwe image) does work.

Project status

The tokio-uring project is still very young. Currently, we are focusing on supporting filesystem and network operations. Eventually, we will add safe APIs for all io-uring compatible operations.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio-uring by you, shall be licensed as MIT, without any additional terms or conditions.