[][src]Struct iou::sqe::SQE

pub struct SQE<'a> { /* fields omitted */ }

A pending IO event.

Can be configured with a set of SubmissionFlags.

Implementations

impl<'a> SQE<'a>[src]

pub fn user_data(&self) -> u64[src]

Get this event's user data.

pub unsafe fn set_user_data(&mut self, user_data: u64)[src]

Set this event's user data. User data is intended to be used by the application after completion.

Note that you should not set user_data to u64::MAX. This value is reserved for timeouts generated by this library, setting an events user_data to that value will cause the event's completion to swallowed by the library and you will never find out that the event completed.

Safety

This function is marked unsafe. The library from which you obtained this SQE may impose additional safety invariants which you must adhere to when setting the user_data for a submission queue event, which it may rely on when processing the corresponding completion queue event. For example, the library ringbahn

Example

unsafe { sq_event.set_user_data(0xB00); }
ring.submit_sqes()?;

let cq_event = ring.wait_for_cqe()?;
assert_eq!(cq_event.user_data(), 0xB00);

pub fn flags(&self) -> SubmissionFlags[src]

Get this event's flags.

pub fn overwrite_flags(&mut self, flags: SubmissionFlags)[src]

Overwrite this event's flags.

pub fn set_flags(&mut self, flags: SubmissionFlags)[src]

Set these flags for this event (any flags already set will still be set).

pub fn set_personality(&mut self, personality: Personality)[src]

Set the Personality associated with this submission.

pub unsafe fn prep_read(
    &mut self,
    fd: impl UringFd,
    buf: impl UringReadBuf,
    offset: u64
)
[src]

Prepare a read on a file descriptor.

Both the file descriptor and the buffer can be pre-registered. See the `registrar module for more information.

pub unsafe fn prep_read_vectored(
    &mut self,
    fd: impl UringFd,
    bufs: &mut [IoSliceMut<'_>],
    offset: u64
)
[src]

Prepare a vectored read on a file descriptor.

pub unsafe fn prep_read_fixed(
    &mut self,
    fd: impl UringFd,
    buf: &mut [u8],
    offset: u64,
    buf_index: u32
)
[src]

Prepare a read into a fixed, pre-registered buffer on a file descriptor.

pub unsafe fn prep_write(
    &mut self,
    fd: impl UringFd,
    buf: impl UringWriteBuf,
    offset: u64
)
[src]

Prepare a write on a file descriptor.

Both the file descriptor and the buffer can be pre-registered. See the `registrar module for more information.

pub unsafe fn prep_write_vectored(
    &mut self,
    fd: impl UringFd,
    bufs: &[IoSlice<'_>],
    offset: u64
)
[src]

Prepare a vectored write on a file descriptor.

pub unsafe fn prep_write_fixed(
    &mut self,
    fd: impl UringFd,
    buf: &[u8],
    offset: u64,
    buf_index: usize
)
[src]

Prepare a write on a file descriptor from a fixed, pre-registered buffer.

pub unsafe fn prep_fsync(&mut self, fd: impl UringFd, flags: FsyncFlags)[src]

Prepare an fsync on a file descriptor.

pub unsafe fn prep_splice(
    &mut self,
    fd_in: RawFd,
    off_in: i64,
    fd_out: RawFd,
    off_out: i64,
    count: u32,
    flags: SpliceFlags
)
[src]

Prepare a splice, copying data from one file descriptor to another.

pub unsafe fn prep_recv(
    &mut self,
    fd: impl UringFd,
    buf: &mut [u8],
    flags: MsgFlags
)
[src]

Prepare a recv event on a file descriptor.

pub unsafe fn prep_send(
    &mut self,
    fd: impl UringFd,
    buf: &[u8],
    flags: MsgFlags
)
[src]

Prepare a send event on a file descriptor.

pub unsafe fn prep_recvmsg(
    &mut self,
    fd: impl UringFd,
    msg: *mut msghdr,
    flags: MsgFlags
)
[src]

Prepare a recvmsg event on a file descriptor.

pub unsafe fn prep_sendmsg(
    &mut self,
    fd: impl UringFd,
    msg: *mut msghdr,
    flags: MsgFlags
)
[src]

Prepare a sendmsg event on a file descriptor.

pub unsafe fn prep_fallocate(
    &mut self,
    fd: impl UringFd,
    offset: u64,
    size: u64,
    flags: FallocateFlags
)
[src]

Prepare a fallocate event.

pub unsafe fn prep_statx(
    &mut self,
    dirfd: impl UringFd,
    path: &CStr,
    flags: StatxFlags,
    mask: StatxMode,
    buf: &mut statx
)
[src]

Prepare a statx event.

pub unsafe fn prep_openat(
    &mut self,
    fd: impl UringFd,
    path: &CStr,
    flags: OFlag,
    mode: Mode
)
[src]

Prepare an openat event.

pub unsafe fn prep_close(&mut self, fd: impl UringFd)[src]

Prepare a close event on a file descriptor.

pub unsafe fn prep_timeout(
    &mut self,
    ts: &__kernel_timespec,
    events: u32,
    flags: TimeoutFlags
)
[src]

Prepare a timeout event.

// make a one-second timeout
let timeout_spec: _ = uring_sys::__kernel_timespec {
    tv_sec:  1 as _,
    tv_nsec: 0 as _,
};

unsafe { sqe.prep_timeout(&timeout_spec, 0, TimeoutFlags::empty()); }

ring.submit_sqes()?;

pub unsafe fn prep_timeout_remove(&mut self, user_data: u64)[src]

pub unsafe fn prep_poll_add(&mut self, fd: impl UringFd, poll_flags: PollFlags)[src]

pub unsafe fn prep_poll_remove(&mut self, user_data: u64)[src]

pub unsafe fn prep_connect(&mut self, fd: impl UringFd, socket_addr: &SockAddr)[src]

pub unsafe fn prep_accept(
    &mut self,
    fd: impl UringFd,
    accept: Option<&mut SockAddrStorage>,
    flags: SockFlag
)
[src]

pub unsafe fn prep_fadvise(
    &mut self,
    fd: impl UringFd,
    off: u64,
    len: u64,
    advice: PosixFadviseAdvice
)
[src]

pub unsafe fn prep_madvise(&mut self, data: &mut [u8], advice: MmapAdvise)[src]

pub unsafe fn prep_epoll_ctl(
    &mut self,
    epoll_fd: RawFd,
    op: EpollOp,
    fd: RawFd,
    event: Option<&mut EpollEvent>
)
[src]

pub unsafe fn prep_files_update(&mut self, files: &[RawFd], offset: u32)[src]

pub unsafe fn prep_provide_buffers(
    &mut self,
    buffers: &mut [u8],
    count: u32,
    group: BufferGroupId,
    index: u32
)
[src]

pub unsafe fn prep_remove_buffers(&mut self, count: u32, id: BufferGroupId)[src]

pub unsafe fn prep_cancel(&mut self, user_data: u64, flags: i32)[src]

pub unsafe fn prep_nop(&mut self)[src]

Prepare a no-op event.

// example: use a no-op to force a drain

let mut nop = ring.prepare_sqe().unwrap();

nop.set_flags(SubmissionFlags::IO_DRAIN);
unsafe { nop.prep_nop(); }

ring.submit_sqes()?;

pub fn clear(&mut self)[src]

Clear event. Clears user data, flags, and any event setup.

unsafe { sqe.set_user_data(0x1010); }
sqe.set_flags(SubmissionFlags::IO_DRAIN);

sqe.clear();

assert_eq!(sqe.user_data(), 0x0);
assert_eq!(sqe.flags(), SubmissionFlags::empty());

pub fn raw(&self) -> &io_uring_sqe[src]

Get a reference to the underlying uring_sys::io_uring_sqe object.

You can use this method to inspect the low-level details of an event.

unsafe { sqe.prep_nop(); }

let sqe_ref = sqe.raw();

assert_eq!(sqe_ref.len, 0);

pub unsafe fn raw_mut(&mut self) -> &mut io_uring_sqe[src]

Trait Implementations

impl<'a> Send for SQE<'a>[src]

impl<'a> Sync for SQE<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for SQE<'a>

impl<'a> Unpin for SQE<'a>

impl<'a> !UnwindSafe for SQE<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.