pub struct ReactorApi { /* private fields */ }Expand description
Api for io-uring reactor.
Implementations§
Source§impl ReactorApi
impl ReactorApi
Sourcepub fn is_new(&self) -> bool
pub fn is_new(&self) -> bool
Check if the ring was set up with IORING_SETUP_SINGLE_ISSUER, so the
kernel is 6.0 or greater and supports IORING_RECVSEND_POLL_FIRST (5.19)
Sourcepub unsafe fn submit<F>(&self, id: u32, f: F)where
F: FnOnce(&mut Entry),
pub unsafe fn submit<F>(&self, id: u32, f: F)where
F: FnOnce(&mut Entry),
Submit request to the driver.
f initializes a zeroed submission entry in place with an opcode.
§Safety
The kernel uses the entry after this call returns. Every buffer,
address and file descriptor the entry refers to must stay valid, and
must not move, until the handler receives the completion for id.
Canceling the request does not end this, the completion still arrives.
f runs while the entry is borrowed from the submission queue, it
must not submit or cancel requests on this reactor. Debug builds panic
if it does.
Sourcepub fn is_supported(&self, opcode: u8) -> bool
pub fn is_supported(&self, opcode: u8) -> bool
Get whether a specific io-uring opcode is supported.
Sourcepub unsafe fn register_buf_ring(
&self,
ring_addr: u64,
entries: u16,
bgid: u16,
) -> Result<(), Error>
pub unsafe fn register_buf_ring( &self, ring_addr: u64, entries: u16, bgid: u16, ) -> Result<(), Error>
Registers a provided buffer ring.
§Safety
The ring at ring_addr with entries entries must stay valid until
it is unregistered with
unregister_buf_ring.
Sourcepub fn unregister_buf_ring(&self, bgid: u16) -> Result<(), Error>
pub fn unregister_buf_ring(&self, bgid: u16) -> Result<(), Error>
Unregisters a provided buffer ring.