pub struct Ring { /* private fields */ }Expand description
This type represents the user space side of an io_uring.
An io_uring is split into two queues: the submissions and completions queue.
The SubmissionQueue is public, but doesn’t provide many methods. The
SubmissionQueue is used by I/O types in the crate to schedule asynchronous
operations.
The completions queue is not exposed by the crate and only used internally.
Instead it will wake the Futures exposed by the various I/O types, such
as AsyncFd::write’s Write Future.
Implementations§
source§impl Ring
impl Ring
sourcepub const fn config<'r>(entries: u32) -> Config<'r>
pub const fn config<'r>(entries: u32) -> Config<'r>
Configure a Ring.
entries must be a power of two and in the range 1..=4096.
§Notes
A10 always uses IORING_SETUP_SQPOLL, which required Linux kernel 5.11
to work correctly. Furthermore before Linux 5.13 the user needs the
CAP_SYS_NICE capability if run as non-root.
sourcepub fn new(entries: u32) -> Result<Ring>
pub fn new(entries: u32) -> Result<Ring>
Create a new Ring with the default configuration.
For more configuration options see Config.
sourcepub const fn submission_queue(&self) -> &SubmissionQueue
pub const fn submission_queue(&self) -> &SubmissionQueue
Returns the SubmissionQueue used by this ring.
The SubmissionQueue can be used to queue asynchronous I/O operations.
sourcepub fn poll(&mut self, timeout: Option<Duration>) -> Result<()>
pub fn poll(&mut self, timeout: Option<Duration>) -> Result<()>
Poll the ring for completions.
This will wake all completed Futures with the result of their
operations.
If a zero duration timeout (i.e. Some(Duration::ZERO)) is passed this
function will only wake all already completed operations. It then
guarantees to not make a system call, but it also means it doesn’t
guarantee at least one completion was processed.