axboe-liburing
Rust bindings for io_uring via a transliteration of Jens Axboe's liburing.
Building this crate successfully may require the following in your .cargo/config.toml:
[]
= "/usr/bin/clang-20"
= "/usr/lib/llvm-20/lib"
This crate implements an almost pure Rust version of Jens Axboe's liburing.
All the good names were taken so the package's name is axboe-liburing but the imported crate is liburing_rs.
liburing has tremendous value in that it's a low-level unopinionated set of helpers that form a complete vocabulary for using io_uring. Originally designed as a set of test helpers, liburing is used to setup and teardown rings, register buffer groups, and create and manage SQEs and CQEs. liburing's API offers users a comprehensive way of using io_uring in a simple manner.
axboe-liburing implements the entire header liburing.h in native Rust so that everything is as equally inlined as
if you were using the library from C or C++. This covers around 142 public functions.
Add the crate with:
axboe-liburing ships with the liburing source and builds liburing.a, statically linking it in via the build.rs. This means
that axboe-liburing requires a C toolchain be present on the system in order to build. Typical conventions are followed,
the environment variables CC, CXX are used to set the C and C++ compilers.
CC=clang-19 CXX=clang++-19
Building Tests
axboe-liburing includes a few Rust-specific tests to verify the basic flow works but the lion's share of the testing is
in recycling what already exists in liburing proper. To this end, we need objcopy in order to weaken the io_uring_get_sqe()
symbol present in liburing.a. When cross-compiling, it can be important to specify the objcopy being used. The objcopy
binary can be set via the OBJCOPY environment variable. objcopy ships with gcc toolchains.
Example building liburing tests with liburing-rs:
axboe-liburing is also tested using sanitizers as well. To build the tests with sanitization enabled, one needs to enable
the sanitizers feature. This causes the crate to build liburing.a with sanitization enabled.
RUSTFLAGS='-Zsanitizer=address'
For building the liburing_rs_tests target in test/Makefile, one needs to first configure the project to use sanitization.
# for liburing_rs_test.a, needed for the C test files to link against
# builds everything, including C the default tests which are relied upon to exist by other tests
# build a static library that exports everything from the Rust crate and use a shim header in the
# test files so that they link against the Rust-derived staticlib
Docs
For documentation, see the man pages for the liburing package itself. The Arch Linux pages have relatively up-to-date docs: https://man.archlinux.org/listing/extra/liburing/.
Examples can be found in the main repo: https://github.com/axboe/liburing/tree/master/examples
Example
extern crate liburing_rs;
use ;
use *;