io_uring

Struct 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

pub unsafe fn from_fd(fd: RawFd, params: Parameters) -> Result<Self>

Create an IoUring instance from a pre-opened file descriptor.

§Safety

The caller must uphold that the file descriptor is owned and refers to a uring. The params argument must be equivalent to the those previously filled in by the kernel when the provided ring was created.

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

Source§

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

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.