pub struct IoUring<S: EntryMarker = Entry, C: EntryMarker = Entry> { /* private fields */ }
Expand description
IoUring instance
S
: The ring’s submission queue entry (SQE) type, eithersqueue::Entry
orsqueue::Entry128
;C
: The ring’s completion queue entry (CQE) type, eithercqueue::Entry
orcqueue::Entry32
.
Implementations§
source§impl IoUring<Entry, Entry>
impl IoUring<Entry, Entry>
source§impl<S: EntryMarker, C: EntryMarker> IoUring<S, C>
impl<S: EntryMarker, C: EntryMarker> IoUring<S, C>
sourcepub fn generic_new(entries: u32) -> Result<Self>
pub fn generic_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.
Unlike IoUring::new
, this function is available for any combination of submission queue
entry (SQE) and completion queue entry (CQE) types.
sourcepub fn generic_builder() -> Builder<S, C>
pub fn generic_builder() -> Builder<S, C>
Create a Builder
for an IoUring
instance.
This allows for further customization than generic_new
.
Unlike IoUring::builder
, this function is available for any combination of submission
queue entry (SQE) and completion queue entry (CQE) types.
sourcepub fn submitter(&self) -> Submitter<'_>
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.
sourcepub fn params(&self) -> &Parameters
pub fn params(&self) -> &Parameters
Get the parameters that were used to construct this instance.
sourcepub fn submit(&self) -> Result<usize>
pub fn submit(&self) -> Result<usize>
Initiate asynchronous I/O. See Submitter::submit
for more details.
sourcepub fn submit_and_wait(&self, want: usize) -> Result<usize>
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.
sourcepub fn split(
&mut self
) -> (Submitter<'_>, SubmissionQueue<'_, S>, CompletionQueue<'_, C>)
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.
sourcepub fn submission(&mut self) -> SubmissionQueue<'_, S>
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.
Get the submission queue of the io_uring instance from a shared reference.
Safety
No other SubmissionQueue
s may exist when calling this function.
sourcepub fn completion(&mut self) -> CompletionQueue<'_, C> ⓘ
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.
Get the completion queue of the io_uring instance from a shared reference.
Safety
No other CompletionQueue
s may exist when calling this function.