Skip to content

ihciah/tokio-uring

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (fs::File) 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.

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(())
    })
}

Project status

The tokio-uring project is still very young. Currently, we are focusing on supporting filesystem 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.

About

An io_uring backed runtime for Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%