Expand description
§lio-uring
A safe, ergonomic Rust interface to Linux’s io_uring asynchronous I/O framework.
§Overview
io_uring is a high-performance asynchronous I/O interface for Linux that provides:
- Zero-copy I/O operations
- Batched submission and completion
- Support for a wide variety of operations (file, network, etc.)
- Advanced features like polling, registered buffers, and more
This crate provides a thin, safe wrapper around liburing while maintaining high performance and full access to io_uring features.
§Basic Usage
ⓘ
use lio_uring::{LioUring, operation::Nop};
// Create an io_uring instance with 128 entries
let mut ring = LioUring::new(128)?;
// Submit a no-op operation
let op = Nop::new().build();
unsafe { ring.push(op, 1) }?;
ring.submit()?;
// Wait for completion
let completion = ring.wait()?;
assert_eq!(completion.user_data(), 1);
assert!(completion.is_ok());§Safety
Most operations in io_uring involve raw pointers to user data. This crate marks
the push() method as unsafe because the caller must ensure:
- All pointers in operations remain valid until the operation completes
- Buffers are not accessed mutably while operations are in flight
- File descriptors remain valid until operations complete
Modules§
- operation
- io_uring operations
Structs§
- Completion
- A completed operation with result and metadata
- Entry
- A submission queue entry ready to be pushed to the ring.
- LioUring
- A Linux io_uring instance for high-performance async I/O.
- Params
- Configuration parameters for io_uring initialization
- SqeFlags
- Submission Queue Entry flags