Skip to main content

ReactorApi

Struct ReactorApi 

Source
pub struct ReactorApi { /* private fields */ }
Expand description

Api for io-uring reactor.

Implementations§

Source§

impl ReactorApi

Source

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)

Source

pub unsafe fn submit<F>(&self, id: u32, f: F)
where F: FnOnce(&mut SEntry),

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.

Source

pub fn cancel(&self, id: u32)

Attempt to cancel an already issued request.

Source

pub fn is_supported(&self, opcode: u8) -> bool

Get whether a specific io-uring opcode is supported.

Source

pub fn id(&self) -> u16

Id of the handler, unique within the reactor.

Source

pub unsafe fn register_buf_ring( &self, ring_addr: u64, entries: u16, bgid: u16, ) -> Result<()>

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.

Source

pub fn unregister_buf_ring(&self, bgid: u16) -> Result<()>

Unregisters a provided buffer ring.

Source

pub fn register_files_sparse(&self, nr: u32) -> Result<()>

Registers an empty file table with nr slots, kernel 5.19 or greater.

The ring has one table, it is released with the ring.

Source

pub fn register_files_update(&self, offset: u32, fds: &[RawFd]) -> Result<usize>

Replaces slots of the file table starting at offset, -1 clears a slot.

Issued operations keep the file they resolved, a replaced or cleared file is released once they complete.

Trait Implementations§

Source§

impl Debug for ReactorApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V