pub struct Flags { /* private fields */ }
Expand description
Submission flags
Implementations§
source§impl Flags
impl Flags
sourcepub const IO_DRAIN: Self = _
pub const IO_DRAIN: Self = _
When this flag is specified, the SQE will not be started before previously submitted SQEs have completed, and new SQEs will not be started before this one completes.
sourcepub const IO_LINK: Self = _
pub const IO_LINK: Self = _
When this flag is specified, it forms a link with the next SQE in the submission ring. That next SQE will not be started before this one completes.
sourcepub const IO_HARDLINK: Self = _
pub const IO_HARDLINK: Self = _
Like IO_LINK
, but it doesn’t sever regardless of the completion
result.
sourcepub const ASYNC: Self = _
pub const ASYNC: Self = _
Normal operation for io_uring is to try and issue an sqe as non-blocking first, and if that fails, execute it in an async manner.
To support more efficient overlapped operation of requests that the application knows/assumes will always (or most of the time) block, the application can ask for an sqe to be issued async from the start.
sourcepub const BUFFER_SELECT: Self = _
pub const BUFFER_SELECT: Self = _
Conceptually the kernel holds a set of buffers organized into groups. When you issue a
request with this flag and set buf_group
to a valid buffer group ID (e.g.
buf_group
on Read
) then once the file descriptor
becomes ready the kernel will try to take a buffer from the group.
If there are no buffers in the group, your request will fail with -ENOBUFS
. Otherwise,
the corresponding cqueue::Entry::flags
will contain the
chosen buffer ID, encoded with:
(buffer_id << IORING_CQE_BUFFER_SHIFT) | IORING_CQE_F_BUFFER
You can use buffer_select
to take the buffer ID.
The buffer will then be removed from the group and won’t be usable by other requests anymore.
You can provide new buffers in a group with
ProvideBuffers
.
sourcepub const SKIP_SUCCESS: Self = _
pub const SKIP_SUCCESS: Self = _
Don’t post CQE if request succeeded.
sourcepub const fn bits(&self) -> u8
pub const fn bits(&self) -> u8
Returns the raw value of the flags currently stored.
Examples found in repository?
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
pub fn flags(mut self, flags: Flags) -> Entry {
self.0.flags |= flags.bits();
self
}
/// Set the user data. This is an application-supplied value that will be passed straight
/// through into the [completion queue entry](crate::cqueue::Entry::user_data).
#[inline]
pub fn user_data(mut self, user_data: u64) -> Entry {
self.0.user_data = user_data;
self
}
/// Set the personality of this event. You can obtain a personality using
/// [`Submitter::register_personality`](crate::Submitter::register_personality).
pub fn personality(mut self, personality: u16) -> Entry {
self.0.personality = personality;
self
}
}
impl Sealed for Entry {
const ADDITIONAL_FLAGS: u32 = 0;
}
impl EntryMarker for Entry {}
impl Clone for Entry {
fn clone(&self) -> Entry {
// io_uring_sqe doesn't implement Clone due to the 'cmd' incomplete array field.
Entry(unsafe { mem::transmute_copy(&self.0) })
}
}
impl Debug for Entry {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("Entry")
.field("op_code", &self.0.opcode)
.field("flags", &self.0.flags)
.field("user_data", &self.0.user_data)
.finish()
}
}
impl Entry128 {
/// Set the submission event's [flags](Flags).
#[inline]
pub fn flags(mut self, flags: Flags) -> Entry128 {
self.0 .0.flags |= flags.bits();
self
}
sourcepub const fn from_bits(bits: u8) -> Option<Self>
pub const fn from_bits(bits: u8) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u8) -> Self
pub const fn from_bits_truncate(bits: u8) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u8) -> Self
pub const unsafe fn from_bits_unchecked(bits: u8) -> Self
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
source§impl BitAndAssign<Flags> for Flags
impl BitAndAssign<Flags> for Flags
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
source§impl BitOrAssign<Flags> for Flags
impl BitOrAssign<Flags> for Flags
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
source§impl BitXorAssign<Flags> for Flags
impl BitXorAssign<Flags> for Flags
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
source§impl Extend<Flags> for Flags
impl Extend<Flags> for Flags
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<Flags> for Flags
impl FromIterator<Flags> for Flags
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
source§impl Ord for Flags
impl Ord for Flags
source§impl PartialOrd<Flags> for Flags
impl PartialOrd<Flags> for Flags
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl SubAssign<Flags> for Flags
impl SubAssign<Flags> for Flags
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.