pub struct KernelAsyncRing { /* private fields */ }Expand description
A kernel async-I/O ring backed by an io_uring instance.
Implementations§
Source§impl KernelAsyncRing
impl KernelAsyncRing
Sourcepub fn new(entries: u32) -> Result<Self>
pub fn new(entries: u32) -> Result<Self>
Create a ring with entries submission slots. Fails on kernels
without io_uring (e.g. some containers) so callers can fall
back to synchronous I/O.
Sourcepub unsafe fn prepare_read(
&mut self,
file: &File,
buf: *mut u8,
len: u32,
offset: u64,
user_data: u64,
) -> Result<()>
pub unsafe fn prepare_read( &mut self, file: &File, buf: *mut u8, len: u32, offset: u64, user_data: u64, ) -> Result<()>
Queue a read of len bytes from file at offset into buf,
tagged with user_data. Open file with
open_for_async_read.
§Safety
buf must remain valid and not move until the matching
completion is reaped - the kernel writes into it asynchronously.
Sourcepub fn submit_and_wait(&mut self, want: u32) -> Result<u32>
pub fn submit_and_wait(&mut self, want: u32) -> Result<u32>
Submit all queued ops and block until at least want complete.
Sourcepub fn reap(&mut self) -> Option<Completion>
pub fn reap(&mut self) -> Option<Completion>
Reap one completion if available.
Auto Trait Implementations§
impl Freeze for KernelAsyncRing
impl RefUnwindSafe for KernelAsyncRing
impl Send for KernelAsyncRing
impl Sync for KernelAsyncRing
impl Unpin for KernelAsyncRing
impl UnsafeUnpin for KernelAsyncRing
impl UnwindSafe for KernelAsyncRing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more