Trait bitflags::Flags

source ·
pub trait Flags: Sized + 'static {
    type Bits: Bits;

    const FLAGS: &'static [Flag<Self>];
Show 22 methods fn bits(&self) -> Self::Bits; fn from_bits_retain(bits: Self::Bits) -> Self; fn empty() -> Self { ... } fn all() -> Self { ... } fn from_bits(bits: Self::Bits) -> Option<Self> { ... } fn from_bits_truncate(bits: Self::Bits) -> Self { ... } fn from_name(name: &str) -> Option<Self> { ... } fn iter(&self) -> Iter<Self> { ... } fn iter_names(&self) -> IterNames<Self> { ... } fn is_empty(&self) -> bool { ... } fn is_all(&self) -> bool { ... } fn intersects(&self, other: Self) -> bool
    where
        Self: Sized
, { ... } fn contains(&self, other: Self) -> bool
    where
        Self: Sized
, { ... } fn insert(&mut self, other: Self)
    where
        Self: Sized
, { ... } fn remove(&mut self, other: Self)
    where
        Self: Sized
, { ... } fn toggle(&mut self, other: Self)
    where
        Self: Sized
, { ... } fn set(&mut self, other: Self, value: bool)
    where
        Self: Sized
, { ... } fn intersection(self, other: Self) -> Self { ... } fn union(self, other: Self) -> Self { ... } fn difference(self, other: Self) -> Self { ... } fn symmetric_difference(self, other: Self) -> Self { ... } fn complement(self) -> Self { ... }
}
Expand description

A set of flags.

This trait is automatically implemented for flags types defined using the bitflags! macro. It can also be implemented manually for custom flags types.

Required Associated Types§

The underlying storage type.

Required Associated Constants§

The set of available flags and their names.

Required Methods§

Returns the raw value of the flags currently stored.

Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

Provided Methods§

Returns an empty set of flags.

Returns the set containing all flags.

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

Note that each multi-bit flag is treated as a unit for this comparison.

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

Note that each multi-bit flag is treated as a unit for this comparison.

Get the flag for a particular name.

Iterate over enabled flag values.

Iterate over the raw names and bits for enabled flag values.

Returns true if no flags are currently stored.

Returns true if all flags are currently set.

Returns true if there are flags common to both self and other.

Returns true if all of the flags in other are contained within self.

Inserts the specified flags in-place.

This method is equivalent to union.

Removes the specified flags in-place.

This method is equivalent to difference.

Toggles the specified flags in-place.

This method is equivalent to symmetric_difference.

Inserts or removes the specified flags depending on the passed value.

Returns the intersection between the flags in self and other.

Returns the union of between the flags in self and other.

Returns the difference between the flags in self and other.

Returns the symmetric difference between the flags in self and other.

Returns the complement of this set of flags.

Implementors§