Compio
A thread-per-core Rust runtime with IOCP/io_uring/mio. The name comes from "completion-based IO". This crate is inspired by monoio.
Why not Tokio?
Tokio is a great generic-propose async runtime. However, it is poll-based, and even uses undocumented APIs on Windows. We would like some new high-level APIs to perform IOCP/io_uring.
Unlike tokio-uring
, this runtime isn't Tokio-based.
This is mainly because that no public APIs to control IOCP in mio
,
and tokio
won't public APIs to control mio
before mio
reaches 1.0.
Quick start
With runtime
feature enabled, we can use the high level APIs to perform fs & net IO.
use ;
let buffer = block_on;
println!;
While you can also control the low-level driver manually:
use ;
let mut driver = new.unwrap;
let file = open.unwrap;
// Attach the `RawFd` to driver first.
driver.attach.unwrap;
// Create operation and push it to the driver.
let mut op = new;
unsafe .unwrap;
// Poll the driver and wait for IO completed.
let entry = driver.poll_one.unwrap;
assert_eq!;
// Resize the buffer by return value.
let n = entry.into_result.unwrap;
let mut buffer = op.into_inner.into_inner;
unsafe
println!;