Struct io_uring::IoUring

source ·
pub struct IoUring<S = Entry, C = Entry>
where S: EntryMarker, C: EntryMarker,
{ /* private fields */ }
Expand description

IoUring instance

Implementations§

source§

impl IoUring<Entry, Entry>

source

pub fn new(entries: u32) -> Result<Self>

Create a new IoUring instance with default configuration parameters. See Builder to customize it further.

The entries sets the size of queue, and its value should be the power of two.

source§

impl<S: EntryMarker, C: EntryMarker> IoUring<S, C>

source

pub fn builder() -> Builder<S, C>

Create a Builder for an IoUring instance.

This allows for further customization than new.

Unlike IoUring::new, this function is available for any combination of submission queue entry (SQE) and completion queue entry (CQE) types.

source

pub fn submitter(&self) -> Submitter<'_>

Get the submitter of this io_uring instance, which can be used to submit submission queue events to the kernel for execution and to register files or buffers with it.

source

pub fn params(&self) -> &Parameters

Get the parameters that were used to construct this instance.

source

pub fn submit(&self) -> Result<usize>

Initiate asynchronous I/O. See Submitter::submit for more details.

source

pub fn submit_and_wait(&self, want: usize) -> Result<usize>

Initiate and/or complete asynchronous I/O. See Submitter::submit_and_wait for more details.

source

pub fn split( &mut self ) -> (Submitter<'_>, SubmissionQueue<'_, S>, CompletionQueue<'_, C>)

Get the submitter, submission queue and completion queue of the io_uring instance. This can be used to operate on the different parts of the io_uring instance independently.

If you use this method to obtain sq and cq, please note that you need to drop or sync the queue before and after submit, otherwise the queue will not be updated.

source

pub fn submission(&mut self) -> SubmissionQueue<'_, S>

Get the submission queue of the io_uring instance. This is used to send I/O requests to the kernel.

source

pub unsafe fn submission_shared(&self) -> SubmissionQueue<'_, S>

Get the submission queue of the io_uring instance from a shared reference.

§Safety

No other SubmissionQueues may exist when calling this function.

source

pub fn completion(&mut self) -> CompletionQueue<'_, C>

Get completion queue of the io_uring instance. This is used to receive I/O completion events from the kernel.

source

pub unsafe fn completion_shared(&self) -> CompletionQueue<'_, C>

Get the completion queue of the io_uring instance from a shared reference.

§Safety

No other CompletionQueues may exist when calling this function.

Trait Implementations§

source§

impl<S: EntryMarker, C: EntryMarker> AsRawFd for IoUring<S, C>

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl<S: EntryMarker, C: EntryMarker> Drop for IoUring<S, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<S: EntryMarker, C: EntryMarker> Send for IoUring<S, C>

source§

impl<S: EntryMarker, C: EntryMarker> Sync for IoUring<S, C>

Auto Trait Implementations§

§

impl<S, C> Freeze for IoUring<S, C>

§

impl<S, C> RefUnwindSafe for IoUring<S, C>

§

impl<S, C> Unpin for IoUring<S, C>

§

impl<S, C> UnwindSafe for IoUring<S, C>

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
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.

source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.