Struct enumflags2::BitFlags[][src]

#[repr(transparent)]
pub struct BitFlags<T: RawBitFlags> { /* fields omitted */ }
Expand description

Represents a set of flags of some type T. The type must have the #[derive(BitFlags)] attribute applied.

Implementations

Create a new BitFlags unsafely, without checking if the bits form a valid bit pattern for the type.

Consider using from_bits or from_bits_truncate instead.

Safety

The argument must not have set bits at positions not corresponding to any flag.

Create an empty BitFlags. Empty means 0.

Create a BitFlags with all flags set.

Returns true if all flags are set

Returns true if no flag is set

Returns the underlying type value

Returns true if at least one flag is shared.

Returns true if all flags are contained.

Returns a BitFlags<T> if the raw value provided does not contain any illegal flags.

Turn a T into a BitFlags<T>. Also available as flag.into().

Truncates flags that are illegal

Toggles the matching bits

Inserts the flags into the BitFlag

Removes the matching flags

Returns an iterator that yields each set flag

Trait Implementations

Formats the value using the given formatter.

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Performs the ^= operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The default value returned is one with all flags unset, i. e. empty.

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Performs the conversion.

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Formats the value using the given formatter.

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

Formats the value using the given formatter.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.