A steamy river of uring. Fast IO using io_uring.

io_uring is going to change everything. It will speed up your disk usage by like 300%. Go ahead, run the O_DIRECT example and compare that to using a threadpool or anything you want. It's not gonna come close!

Starting in linux 5.5, it also has support for tcp accept. This is gonna shred everything out there!!!

But there's a few snags. Mainly, it's a little misuse-prone. But Rust is pretty nice for specifying proofs about memory usage in the type system. And we don't even have to get too squirley. Check out the write_at implementation, for example. It just says that the Completion, the underlying uring, the file being used, the buffer being used, etc... will all be in scope at the same time while the Completion is in-use.

This library aims to be misuse-resistant. Most of the other io_uring libraries make it really easy to blow your legs off with use-after-frees. rio uses standard Rust lifetime specification to make use-after-frees fail to compile. Also, if a Completion that was pinned to the lifetime of a uring and backing buffer is dropped, it waits for its backing operation to complete before returning from Drop, to further prevent use-after-frees. use-after-frees are not expressible when using rio .

This won't compile:

ⓘ This example deliberately fails to compile

let rio = rio :: new (). unwrap (); let file = std :: fs :: File :: open ( "use_after_free" ). unwrap (); let out_buf = vec ! [ 42 ; 666 ]; let completion = rio . write_at ( & file , & out_buf , 0 ). unwrap (); drop ( out_io_slice ); drop ( file ); drop ( rio ); completion . wait ();

Really shines with O_DIRECT: