pub struct OptionFlags { /* private fields */ }Implementations§
§impl OptionFlags
impl OptionFlags
pub const NONE: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_NONE as _,}
pub const HIDDEN: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_HIDDEN as _,}
pub const IN_MAIN: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_IN_MAIN as _,}
pub const REVERSE: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_REVERSE as _,}
pub const NO_ARG: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_NO_ARG as _,}
pub const FILENAME: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_FILENAME as _,}
pub const OPTIONAL_ARG: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_OPTIONAL_ARG as _,}
pub const NOALIAS: OptionFlags = Self{ bits: ffi::G_OPTION_FLAG_NOALIAS as _,}
pub const fn empty() -> OptionFlags
pub const fn empty() -> OptionFlags
Returns an empty set of flags.
pub const fn all() -> OptionFlags
pub const fn all() -> OptionFlags
Returns the set containing all flags.
pub const fn from_bits(bits: u32) -> Option<OptionFlags>
pub const fn from_bits(bits: u32) -> Option<OptionFlags>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub const fn from_bits_truncate(bits: u32) -> OptionFlags
pub const fn from_bits_truncate(bits: u32) -> OptionFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u32) -> OptionFlags
pub const unsafe fn from_bits_unchecked(bits: u32) -> OptionFlags
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.
pub const fn intersects(&self, other: OptionFlags) -> bool
pub const fn intersects(&self, other: OptionFlags) -> bool
Returns true if there are flags common to both self and other.
pub const fn contains(&self, other: OptionFlags) -> bool
pub const fn contains(&self, other: OptionFlags) -> bool
Returns true if all of the flags in other are contained within self.
pub fn insert(&mut self, other: OptionFlags)
pub fn insert(&mut self, other: OptionFlags)
Inserts the specified flags in-place.
pub fn remove(&mut self, other: OptionFlags)
pub fn remove(&mut self, other: OptionFlags)
Removes the specified flags in-place.
pub fn toggle(&mut self, other: OptionFlags)
pub fn toggle(&mut self, other: OptionFlags)
Toggles the specified flags in-place.
pub fn set(&mut self, other: OptionFlags, value: bool)
pub fn set(&mut self, other: OptionFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: OptionFlags) -> OptionFlags
pub const fn intersection(self, other: OptionFlags) -> OptionFlags
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.
pub const fn union(self, other: OptionFlags) -> OptionFlags
pub const fn union(self, other: OptionFlags) -> OptionFlags
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.
pub const fn difference(self, other: OptionFlags) -> OptionFlags
pub const fn difference(self, other: OptionFlags) -> OptionFlags
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.
pub const fn symmetric_difference(self, other: OptionFlags) -> OptionFlags
pub const fn symmetric_difference(self, other: OptionFlags) -> OptionFlags
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.
pub const fn complement(self) -> OptionFlags
pub const fn complement(self) -> OptionFlags
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§
§impl Binary for OptionFlags
impl Binary for OptionFlags
§impl BitAnd<OptionFlags> for OptionFlags
impl BitAnd<OptionFlags> for OptionFlags
§fn bitand(self, other: OptionFlags) -> OptionFlags
fn bitand(self, other: OptionFlags) -> OptionFlags
Returns the intersection between the two sets of flags.
§type Output = OptionFlags
type Output = OptionFlags
& operator.§impl BitAndAssign<OptionFlags> for OptionFlags
impl BitAndAssign<OptionFlags> for OptionFlags
§fn bitand_assign(&mut self, other: OptionFlags)
fn bitand_assign(&mut self, other: OptionFlags)
Disables all flags disabled in the set.
§impl BitOr<OptionFlags> for OptionFlags
impl BitOr<OptionFlags> for OptionFlags
§fn bitor(self, other: OptionFlags) -> OptionFlags
fn bitor(self, other: OptionFlags) -> OptionFlags
Returns the union of the two sets of flags.
§type Output = OptionFlags
type Output = OptionFlags
| operator.§impl BitOrAssign<OptionFlags> for OptionFlags
impl BitOrAssign<OptionFlags> for OptionFlags
§fn bitor_assign(&mut self, other: OptionFlags)
fn bitor_assign(&mut self, other: OptionFlags)
Adds the set of flags.
§impl BitXor<OptionFlags> for OptionFlags
impl BitXor<OptionFlags> for OptionFlags
§fn bitxor(self, other: OptionFlags) -> OptionFlags
fn bitxor(self, other: OptionFlags) -> OptionFlags
Returns the left flags, but with all the right flags toggled.
§type Output = OptionFlags
type Output = OptionFlags
^ operator.§impl BitXorAssign<OptionFlags> for OptionFlags
impl BitXorAssign<OptionFlags> for OptionFlags
§fn bitxor_assign(&mut self, other: OptionFlags)
fn bitxor_assign(&mut self, other: OptionFlags)
Toggles the set of flags.
§impl Clone for OptionFlags
impl Clone for OptionFlags
§fn clone(&self) -> OptionFlags
fn clone(&self) -> OptionFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for OptionFlags
impl Debug for OptionFlags
§impl Display for OptionFlags
impl Display for OptionFlags
§impl Extend<OptionFlags> for OptionFlags
impl Extend<OptionFlags> for OptionFlags
§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = OptionFlags>,
fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = OptionFlags>,
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)§impl FromIterator<OptionFlags> for OptionFlags
impl FromIterator<OptionFlags> for OptionFlags
§fn from_iter<T>(iterator: T) -> OptionFlagswhere
T: IntoIterator<Item = OptionFlags>,
fn from_iter<T>(iterator: T) -> OptionFlagswhere T: IntoIterator<Item = OptionFlags>,
§impl Hash for OptionFlags
impl Hash for OptionFlags
§impl LowerHex for OptionFlags
impl LowerHex for OptionFlags
§impl Not for OptionFlags
impl Not for OptionFlags
§fn not(self) -> OptionFlags
fn not(self) -> OptionFlags
Returns the complement of this set of flags.
§type Output = OptionFlags
type Output = OptionFlags
! operator.§impl Octal for OptionFlags
impl Octal for OptionFlags
§impl Ord for OptionFlags
impl Ord for OptionFlags
§impl PartialEq<OptionFlags> for OptionFlags
impl PartialEq<OptionFlags> for OptionFlags
§fn eq(&self, other: &OptionFlags) -> bool
fn eq(&self, other: &OptionFlags) -> bool
self and other values to be equal, and is used
by ==.§impl PartialOrd<OptionFlags> for OptionFlags
impl PartialOrd<OptionFlags> for OptionFlags
§fn partial_cmp(&self, other: &OptionFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &OptionFlags) -> Option<Ordering>
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 more§impl Sub<OptionFlags> for OptionFlags
impl Sub<OptionFlags> for OptionFlags
§fn sub(self, other: OptionFlags) -> OptionFlags
fn sub(self, other: OptionFlags) -> OptionFlags
Returns the set difference of the two sets of flags.
§type Output = OptionFlags
type Output = OptionFlags
- operator.§impl SubAssign<OptionFlags> for OptionFlags
impl SubAssign<OptionFlags> for OptionFlags
§fn sub_assign(&mut self, other: OptionFlags)
fn sub_assign(&mut self, other: OptionFlags)
Disables all flags enabled in the set.