3 releases

0.0.5 Nov 8, 2022
0.0.4 Oct 5, 2022
0.0.2 Oct 5, 2022

#1041 in Asynchronous

Download history 64/week @ 2024-02-18 51/week @ 2024-02-25 9/week @ 2024-03-03 7/week @ 2024-03-10 5/week @ 2024-03-17 6/week @ 2024-03-24 43/week @ 2024-03-31 2/week @ 2024-04-07

52 downloads per month
Used in 3 crates (via photonio)

MIT license

23KB
607 lines

PhotonIO

crates docs

PhotonIO is an efficient runtime for asynchronous applications in Rust.

Features

  • Asynchronous filesystem and networking I/O for Linux based on io_uring.
  • A fallback implementation for other platforms based on Tokio.
  • A multi-thread runtime.

Examples

use photonio::{fs::File, io::Write, io::WriteAt};

#[photonio::main]
async fn main() -> std::io::Result<()> {
    let mut file = File::create("hello.txt").await?;
    file.write(b"hello").await?;
    file.write_at(b"world", 5).await?;
    Ok(())
}

Limitations

  • Dropping an unfinished future for asynchronous filesystem or networking operations will result in a panic. However, this behavior might be change in the future.
  • The current multi-thread runtime uses a naive round-robin fashion to schedule tasks. A work-stealing scheduler will be added in the future.

lib.rs:

A PhotonIO implementation based on Tokio.

Dependencies

~3–9.5MB
~72K SLoC