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