pub struct ExampleEnumSet { /* private fields */ }
doc
or test
only.Expand description
Represents a set of ExampleEnum
variants.
Implementations§
Source§impl ExampleEnumSet
§Custom fields operations
impl ExampleEnumSet
§Custom fields operations
Sourcepub const fn without_fields() -> Self
pub const fn without_fields() -> Self
Returns a new ExampleEnumSet
with none of the fields set.
Sourcepub const fn with_all_fields() -> Self
pub const fn with_all_fields() -> Self
Returns a new ExampleEnumSet
with all the fields set.
Sourcepub const fn are_all_fields(self) -> bool
pub const fn are_all_fields(self) -> bool
Returns true
if it all the fields are set.
Source§impl ExampleEnumSet
§Variant0
single field operations
impl ExampleEnumSet
§Variant0
single field operations
Sourcepub const fn with_field_variant0() -> Self
pub const fn with_field_variant0() -> Self
Returns a new ExampleEnumSet
with Variant0
field set.
Sourcepub const fn is_field_variant0(self) -> bool
pub const fn is_field_variant0(self) -> bool
Whether the Variant0
field is set.
Sourcepub const fn bits_field_variant0(self) -> u32 ⓘ
pub const fn bits_field_variant0(self) -> u32 ⓘ
The size in bits of the Variant0
field.
Sourcepub const fn get_field_variant0(self) -> Self
pub const fn get_field_variant0(self) -> Self
A copy of self
with only the bits of Variant0
field.
Sourcepub const fn set_field_variant0(self) -> Self
pub const fn set_field_variant0(self) -> Self
A copy of self
with the Variant0
field set.
Sourcepub fn mut_set_field_variant0(&mut self)
pub fn mut_set_field_variant0(&mut self)
Sets the Variant0
field.
Sourcepub const fn get_field_value_variant0(self) -> Self
pub const fn get_field_value_variant0(self) -> Self
The value at the bit range of Variant0
field.
Sourcepub const fn set_field_value_variant0(self, value: u8) -> Self
pub const fn set_field_value_variant0(self, value: u8) -> Self
Sets the value
into the bitrange of Variant0
field.
Sourcepub const fn unset_field_variant0(self) -> Self
pub const fn unset_field_variant0(self) -> Self
A copy of self
with the Variant0
field set.
Sourcepub fn mut_unset_field_variant0(&mut self)
pub fn mut_unset_field_variant0(&mut self)
Unsets the Variant0
field.
Sourcepub const fn flip_field_variant0(self) -> Self
pub const fn flip_field_variant0(self) -> Self
Returns a copy of self
with the Variant0
field flipped.
Sourcepub fn mut_flip_field_variant0(&mut self)
pub fn mut_flip_field_variant0(&mut self)
Flips the Variant0
field.
Source§impl ExampleEnumSet
§Variant1
single field operations
impl ExampleEnumSet
§Variant1
single field operations
Sourcepub const fn with_field_variant1() -> Self
pub const fn with_field_variant1() -> Self
Returns a new ExampleEnumSet
with Variant1
field set.
Sourcepub const fn is_field_variant1(self) -> bool
pub const fn is_field_variant1(self) -> bool
Whether the Variant1
field is set.
Sourcepub const fn bits_field_variant1(self) -> u32 ⓘ
pub const fn bits_field_variant1(self) -> u32 ⓘ
The size in bits of the Variant1
field.
Sourcepub const fn get_field_variant1(self) -> Self
pub const fn get_field_variant1(self) -> Self
A copy of self
with only the bits of Variant1
field.
Sourcepub const fn set_field_variant1(self) -> Self
pub const fn set_field_variant1(self) -> Self
A copy of self
with the Variant1
field set.
Sourcepub fn mut_set_field_variant1(&mut self)
pub fn mut_set_field_variant1(&mut self)
Sets the Variant1
field.
Sourcepub const fn get_field_value_variant1(self) -> Self
pub const fn get_field_value_variant1(self) -> Self
The value at the bit range of Variant1
field.
Sourcepub const fn set_field_value_variant1(self, value: u8) -> Self
pub const fn set_field_value_variant1(self, value: u8) -> Self
Sets the value
into the bitrange of Variant1
field.
Sourcepub const fn unset_field_variant1(self) -> Self
pub const fn unset_field_variant1(self) -> Self
A copy of self
with the Variant1
field set.
Sourcepub fn mut_unset_field_variant1(&mut self)
pub fn mut_unset_field_variant1(&mut self)
Unsets the Variant1
field.
Sourcepub const fn flip_field_variant1(self) -> Self
pub const fn flip_field_variant1(self) -> Self
Returns a copy of self
with the Variant1
field flipped.
Sourcepub fn mut_flip_field_variant1(&mut self)
pub fn mut_flip_field_variant1(&mut self)
Flips the Variant1
field.
Source§impl ExampleEnumSet
§Variant2
single field operations
impl ExampleEnumSet
§Variant2
single field operations
Sourcepub const fn with_field_variant2() -> Self
pub const fn with_field_variant2() -> Self
Returns a new ExampleEnumSet
with Variant2
field set.
Sourcepub const fn is_field_variant2(self) -> bool
pub const fn is_field_variant2(self) -> bool
Whether the Variant2
field is set.
Sourcepub const fn bits_field_variant2(self) -> u32 ⓘ
pub const fn bits_field_variant2(self) -> u32 ⓘ
The size in bits of the Variant2
field.
Sourcepub const fn get_field_variant2(self) -> Self
pub const fn get_field_variant2(self) -> Self
A copy of self
with only the bits of Variant2
field.
Sourcepub const fn set_field_variant2(self) -> Self
pub const fn set_field_variant2(self) -> Self
A copy of self
with the Variant2
field set.
Sourcepub fn mut_set_field_variant2(&mut self)
pub fn mut_set_field_variant2(&mut self)
Sets the Variant2
field.
Sourcepub const fn get_field_value_variant2(self) -> Self
pub const fn get_field_value_variant2(self) -> Self
The value at the bit range of Variant2
field.
Sourcepub const fn set_field_value_variant2(self, value: u8) -> Self
pub const fn set_field_value_variant2(self, value: u8) -> Self
Sets the value
into the bitrange of Variant2
field.
Sourcepub const fn unset_field_variant2(self) -> Self
pub const fn unset_field_variant2(self) -> Self
A copy of self
with the Variant2
field set.
Sourcepub fn mut_unset_field_variant2(&mut self)
pub fn mut_unset_field_variant2(&mut self)
Unsets the Variant2
field.
Sourcepub const fn flip_field_variant2(self) -> Self
pub const fn flip_field_variant2(self) -> Self
Returns a copy of self
with the Variant2
field flipped.
Sourcepub fn mut_flip_field_variant2(&mut self)
pub fn mut_flip_field_variant2(&mut self)
Flips the Variant2
field.
Source§impl ExampleEnumSet
§Variant3
single field operations
impl ExampleEnumSet
§Variant3
single field operations
Sourcepub const fn with_field_variant3() -> Self
pub const fn with_field_variant3() -> Self
Returns a new ExampleEnumSet
with Variant3
field set.
Sourcepub const fn is_field_variant3(self) -> bool
pub const fn is_field_variant3(self) -> bool
Whether the Variant3
field is set.
Sourcepub const fn bits_field_variant3(self) -> u32 ⓘ
pub const fn bits_field_variant3(self) -> u32 ⓘ
The size in bits of the Variant3
field.
Sourcepub const fn get_field_variant3(self) -> Self
pub const fn get_field_variant3(self) -> Self
A copy of self
with only the bits of Variant3
field.
Sourcepub const fn set_field_variant3(self) -> Self
pub const fn set_field_variant3(self) -> Self
A copy of self
with the Variant3
field set.
Sourcepub fn mut_set_field_variant3(&mut self)
pub fn mut_set_field_variant3(&mut self)
Sets the Variant3
field.
Sourcepub const fn get_field_value_variant3(self) -> Self
pub const fn get_field_value_variant3(self) -> Self
The value at the bit range of Variant3
field.
Sourcepub const fn set_field_value_variant3(self, value: u8) -> Self
pub const fn set_field_value_variant3(self, value: u8) -> Self
Sets the value
into the bitrange of Variant3
field.
Sourcepub const fn unset_field_variant3(self) -> Self
pub const fn unset_field_variant3(self) -> Self
A copy of self
with the Variant3
field set.
Sourcepub fn mut_unset_field_variant3(&mut self)
pub fn mut_unset_field_variant3(&mut self)
Unsets the Variant3
field.
Sourcepub const fn flip_field_variant3(self) -> Self
pub const fn flip_field_variant3(self) -> Self
Returns a copy of self
with the Variant3
field flipped.
Sourcepub fn mut_flip_field_variant3(&mut self)
pub fn mut_flip_field_variant3(&mut self)
Flips the Variant3
field.
Source§impl ExampleEnumSet
§Variant4
single field operations
impl ExampleEnumSet
§Variant4
single field operations
Sourcepub const fn with_field_variant4() -> Self
pub const fn with_field_variant4() -> Self
Returns a new ExampleEnumSet
with Variant4
field set.
Sourcepub const fn is_field_variant4(self) -> bool
pub const fn is_field_variant4(self) -> bool
Whether the Variant4
field is set.
Sourcepub const fn bits_field_variant4(self) -> u32 ⓘ
pub const fn bits_field_variant4(self) -> u32 ⓘ
The size in bits of the Variant4
field.
Sourcepub const fn get_field_variant4(self) -> Self
pub const fn get_field_variant4(self) -> Self
A copy of self
with only the bits of Variant4
field.
Sourcepub const fn set_field_variant4(self) -> Self
pub const fn set_field_variant4(self) -> Self
A copy of self
with the Variant4
field set.
Sourcepub fn mut_set_field_variant4(&mut self)
pub fn mut_set_field_variant4(&mut self)
Sets the Variant4
field.
Sourcepub const fn get_field_value_variant4(self) -> Self
pub const fn get_field_value_variant4(self) -> Self
The value at the bit range of Variant4
field.
Sourcepub const fn set_field_value_variant4(self, value: u8) -> Self
pub const fn set_field_value_variant4(self, value: u8) -> Self
Sets the value
into the bitrange of Variant4
field.
Sourcepub const fn unset_field_variant4(self) -> Self
pub const fn unset_field_variant4(self) -> Self
A copy of self
with the Variant4
field set.
Sourcepub fn mut_unset_field_variant4(&mut self)
pub fn mut_unset_field_variant4(&mut self)
Unsets the Variant4
field.
Sourcepub const fn flip_field_variant4(self) -> Self
pub const fn flip_field_variant4(self) -> Self
Returns a copy of self
with the Variant4
field flipped.
Sourcepub fn mut_flip_field_variant4(&mut self)
pub fn mut_flip_field_variant4(&mut self)
Flips the Variant4
field.
Source§impl ExampleEnumSet
§General bits manipulation functionality
impl ExampleEnumSet
§General bits manipulation functionality
Sourcepub const fn new_zeroed() -> Self
pub const fn new_zeroed() -> Self
Returns self with all bits set to 0.
Sourcepub const fn count_ones(&self) -> u32 ⓘ
pub const fn count_ones(&self) -> u32 ⓘ
The number of bits set (number of ones).
Sourcepub const fn count_zeros(&self) -> u32 ⓘ
pub const fn count_zeros(&self) -> u32 ⓘ
The number of bits unset (number of zeros).
Sourcepub const fn is_bit_set(self, index: u32) -> bool
pub const fn is_bit_set(self, index: u32) -> bool
Sourcepub const fn is_checked_bit_set(
self,
index: u32,
) -> Result<bool, MismatchedBounds> ⓘ
pub const fn is_checked_bit_set( self, index: u32, ) -> Result<bool, MismatchedBounds> ⓘ
Sourcepub const fn get_bit(self, index: u32) -> Self
pub const fn get_bit(self, index: u32) -> Self
Returns a copy of self
with only the value of the bit at index
.
§Panics
Panics in debug if index > MAX_BIT
.
Sourcepub const fn get_checked_bit(self, index: u32) -> Result<Self, MismatchedBounds> ⓘ
pub const fn get_checked_bit(self, index: u32) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
with only the value of the bit at index
, checked.
§Errors
Returns IndexOutOfBounds
if index > MAX_BIT
.
Sourcepub const fn get_shifted_bit(self, index: u32) -> Self
pub const fn get_shifted_bit(self, index: u32) -> Self
Returns a copy of self
with only the value of the bit at index
shifted.
§Panics
Panics in debug if index > MAX_BIT
.
Sourcepub const fn get_shifted_checked_bit(
self,
index: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn get_shifted_checked_bit( self, index: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
with only the value of the bit at index
shifted, checked.
§Errors
Returns IndexOutOfBounds
if index > MAX_BIT
.
Sourcepub const fn set_checked_bit(self, index: u32) -> Result<Self, MismatchedBounds> ⓘ
pub const fn set_checked_bit(self, index: u32) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
setting the bit at index
, checked.
§Errors
Returns IndexOutOfBounds
if index > MAX_BIT
.
Sourcepub fn mut_set_bit(&mut self, index: u32)
pub fn mut_set_bit(&mut self, index: u32)
Sourcepub fn mut_set_checked_bit(
&mut self,
index: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_set_checked_bit( &mut self, index: u32, ) -> Result<(), MismatchedBounds> ⓘ
Sourcepub const fn unset_checked_bit(
self,
index: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn unset_checked_bit( self, index: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
unsetting the bit at index
, checked.
§Errors
Returns IndexOutOfBounds
if index > MAX_BIT
.
Sourcepub fn mut_unset_bit(&mut self, index: u32)
pub fn mut_unset_bit(&mut self, index: u32)
Sourcepub fn mut_unset_checked_bit(
&mut self,
index: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_unset_checked_bit( &mut self, index: u32, ) -> Result<(), MismatchedBounds> ⓘ
Sourcepub const fn flip_checked_bit(
self,
index: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn flip_checked_bit( self, index: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
flipping the bit at index
, checked.
§Errors
Returns IndexOutOfBounds
if index > MAX_BIT
.
Sourcepub fn mut_flip_bit(&mut self, index: u32)
pub fn mut_flip_bit(&mut self, index: u32)
Sourcepub fn mut_flip_checked_bit(
&mut self,
index: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_flip_checked_bit( &mut self, index: u32, ) -> Result<(), MismatchedBounds> ⓘ
Flips the bit at index
, checked.
Source§impl ExampleEnumSet
§Bit ranges
impl ExampleEnumSet
§Bit ranges
Sourcepub const fn mask_range(start: u32, end: u32) -> Self
pub const fn mask_range(start: u32, end: u32) -> Self
Returns a new bitmask of 1s from the [start..=end]
range.
Sets the rest of the bits to 0.
§Panics
Panics if start >= BITS || end >= BITS || start > end
.
Sourcepub const fn mask_checked_range(
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn mask_checked_range( start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a new bitmask of ones from the [start..=end]
checked range.
Sets the rest of the bits to 0.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub const fn get_range(self, start: u32, end: u32) -> Self
pub const fn get_range(self, start: u32, end: u32) -> Self
Gets a copy of self
with only the bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub const fn get_checked_range(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn get_checked_range( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets a copy of self
with only the bits from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub const fn get_value_range(self, start: u32, end: u32) -> Self
pub const fn get_value_range(self, start: u32, end: u32) -> Self
Gets the value of the bits in from the [start..=end]
range.
§Panics
Panics if start >= BITS || end >= BITS || start > end
.
Sourcepub const fn get_value_checked_range(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn get_value_checked_range( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets the value of the bits from the [start..=end]
checked range.
Sets the rest of the bits to 0.
The bits in the specified range are shifted rightwards so that the least significant bit (LSB) aligns with the units place, forming the integer value.
§Errors
Returns IndexOutOfBounds
if start >= BITS || end >= BITS
,
MismatchedIndices
if start > end
, and
DataOverflow
if value
does not fit within the specified bit range.
Sourcepub const fn set_range(self, start: u32, end: u32) -> Self
pub const fn set_range(self, start: u32, end: u32) -> Self
Get a copy of self
with bits set to 1 from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub const fn set_checked_range(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn set_checked_range( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Get a copy of self
with bits set to 1 from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub fn mut_set_range(&mut self, start: u32, end: u32)
pub fn mut_set_range(&mut self, start: u32, end: u32)
Sets the bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub fn mut_set_checked_range(
&mut self,
start: u32,
end: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_set_checked_range( &mut self, start: u32, end: u32, ) -> Result<(), MismatchedBounds> ⓘ
Sets the bits from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub const fn set_value_range(self, value: u8, start: u32, end: u32) -> Self
pub const fn set_value_range(self, value: u8, start: u32, end: u32) -> Self
Gets a copy of self
with the given value
set into the [start..=end]
range.
Leaves the rest of the bits unchanged.
The value is first masked to fit the size of the range, and then
it is inserted into the specified bit range of self
, replacing
the existing bits in that range. The rest of the bits in self
remain unchanged.
§Panics
Panics if start >= BITS || end >= BITS || start > end
.
Sourcepub const fn set_value_checked_range(
self,
value: u8,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn set_value_checked_range( self, value: u8, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets a copy of self
with the given value
set into the [start..=end]
checked range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds
if start >= BITS || end >= BITS
and MismatchedIndices
if start > end
.
Sourcepub const fn set_checked_value_checked_range(
self,
value: u8,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn set_checked_value_checked_range( self, value: u8, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Gets a copy of self
with the given checked value
set into the [start..=end]
checked range.
Leaves the rest of the bits unchanged.
§Errors
Returns IndexOutOfBounds
if start >= BITS || end >= BITS
,
MismatchedIndices
if start > end
, and
DataOverflow
if value
does not fit within the specified bit range.
Sourcepub fn mut_set_value_range(&mut self, value: u8, start: u32, end: u32)
pub fn mut_set_value_range(&mut self, value: u8, start: u32, end: u32)
Sets the given value
into the [start..=end]
range.
Sets the bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub fn mut_set_value_checked_range(
&mut self,
value: u8,
start: u32,
end: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_set_value_checked_range( &mut self, value: u8, start: u32, end: u32, ) -> Result<(), MismatchedBounds> ⓘ
Sets the given value
into the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
and
MismatchedIndices
if start > end
.
Sourcepub fn mut_set_checked_value_checked_range(
&mut self,
value: u8,
start: u32,
end: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_set_checked_value_checked_range( &mut self, value: u8, start: u32, end: u32, ) -> Result<(), MismatchedBounds> ⓘ
Sets the given checked value
into the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
MismatchedIndices
if start > end
, and
DataOverflow
if value
does not fit within the specified bit range.
Sourcepub const fn unset_range(self, start: u32, end: u32) -> Self
pub const fn unset_range(self, start: u32, end: u32) -> Self
Returns a copy of self
with unset bits to 0 from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub const fn unset_checked_range(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn unset_checked_range( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
with unset bits to 0 from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub fn mut_unset_range(&mut self, start: u32, end: u32)
pub fn mut_unset_range(&mut self, start: u32, end: u32)
Unsets the bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub fn mut_unset_checked_range(
&mut self,
start: u32,
end: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_unset_checked_range( &mut self, start: u32, end: u32, ) -> Result<(), MismatchedBounds> ⓘ
Unsets the bits from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub const fn flip_range(self, start: u32, end: u32) -> Self
pub const fn flip_range(self, start: u32, end: u32) -> Self
Returns a copy of self
with flipped bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub const fn flip_checked_range(
self,
start: u32,
end: u32,
) -> Result<Self, MismatchedBounds> ⓘ
pub const fn flip_checked_range( self, start: u32, end: u32, ) -> Result<Self, MismatchedBounds> ⓘ
Returns a copy of self
with flipped bits from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Sourcepub fn mut_flip_range(&mut self, start: u32, end: u32)
pub fn mut_flip_range(&mut self, start: u32, end: u32)
Flips the bits from the [start..=end]
range.
§Panics
Panics in debug if start > MAX_BIT || end > MAX_BIT
or if start > end
.
Sourcepub fn mut_flip_checked_range(
&mut self,
start: u32,
end: u32,
) -> Result<(), MismatchedBounds> ⓘ
pub fn mut_flip_checked_range( &mut self, start: u32, end: u32, ) -> Result<(), MismatchedBounds> ⓘ
Flips the bits from the [start..=end]
checked range.
§Errors
Returns IndexOutOfBounds
if start > MAX_BIT || end > MAX_BIT
,
or MismatchedIndices
if start > end
.
Source§impl ExampleEnumSet
§Bit masks
impl ExampleEnumSet
§Bit masks
Sourcepub const fn contains_mask(self, mask: u8) -> bool
pub const fn contains_mask(self, mask: u8) -> bool
Whether self
contains all the same set bits that are set in mask
.
Sourcepub const fn contains_other(self, other: Self) -> bool
pub const fn contains_other(self, other: Self) -> bool
Whether self
contains all the same set bits that are set in other
.
Sourcepub const fn overlaps_mask(&self, mask: u8) -> bool
pub const fn overlaps_mask(&self, mask: u8) -> bool
Whether there’s at least one set bit in common between self
and mask
.
Sourcepub const fn overlaps_other(&self, other: Self) -> bool
pub const fn overlaps_other(&self, other: Self) -> bool
Whether there’s at least one set bit in common between self
and other
.
Sourcepub const fn intersect_mask(self, mask: u8) -> Self
pub const fn intersect_mask(self, mask: u8) -> Self
A copy of self
with only the bits both in self
and mask
.
Sourcepub const fn intersect_other(self, other: Self) -> Self
pub const fn intersect_other(self, other: Self) -> Self
A copy of self
with only the bits both in self
and other
.
Sourcepub fn mut_intersect_mask(&mut self, mask: u8)
pub fn mut_intersect_mask(&mut self, mask: u8)
Only leaves the bits both in self
and mask
.
Sourcepub fn mut_intersect_other(&mut self, other: Self)
pub fn mut_intersect_other(&mut self, other: Self)
Only leaves the bits both in self
and other
.
Sourcepub const fn set_mask(self, mask: u8) -> Self
pub const fn set_mask(self, mask: u8) -> Self
A copy of self
setting the bits that are set in mask
.
Sourcepub const fn set_other(self, other: Self) -> Self
pub const fn set_other(self, other: Self) -> Self
A copy of self
setting the bits that are set in other
.
Sourcepub fn mut_set_mask(&mut self, mask: u8)
pub fn mut_set_mask(&mut self, mask: u8)
Sets the bits that are set in mask
.
Sourcepub fn mut_set_other(&mut self, other: Self)
pub fn mut_set_other(&mut self, other: Self)
Sets the bits that are set in other
.
Sourcepub const fn unset_mask(self, mask: u8) -> Self
pub const fn unset_mask(self, mask: u8) -> Self
A copy of self
unsetting the bits that are set in mask
.
Sourcepub const fn unset_other(self, other: Self) -> Self
pub const fn unset_other(self, other: Self) -> Self
A copy of self
unsetting the bits that are set in other
.
Sourcepub fn mut_unset_mask(&mut self, mask: u8)
pub fn mut_unset_mask(&mut self, mask: u8)
Unsets the bits that are set in mask
.
Sourcepub fn mut_unset_other(&mut self, other: Self)
pub fn mut_unset_other(&mut self, other: Self)
Unsets the bits that are set in other
.
Sourcepub const fn flip_mask(self, mask: u8) -> Self
pub const fn flip_mask(self, mask: u8) -> Self
A copy of self
flipping the bits that are set in mask
.
Sourcepub const fn flip_other(self, other: Self) -> Self
pub const fn flip_other(self, other: Self) -> Self
Returns a copy of self
flipping the bits that are set in other
.
Sourcepub fn mut_flip_mask(&mut self, mask: u8)
pub fn mut_flip_mask(&mut self, mask: u8)
Flips the bits that are set in mask
.
Sourcepub fn mut_flip_other(&mut self, other: Self)
pub fn mut_flip_other(&mut self, other: Self)
Flips the bits that are set in other
.
Trait Implementations§
Source§impl Binary for ExampleEnumSet
impl Binary for ExampleEnumSet
Source§impl Clone for ExampleEnumSet
impl Clone for ExampleEnumSet
Source§fn clone(&self) -> ExampleEnumSet
fn clone(&self) -> ExampleEnumSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ExampleEnumSet
impl Debug for ExampleEnumSet
Source§impl Default for ExampleEnumSet
impl Default for ExampleEnumSet
Source§impl Display for ExampleEnumSet
impl Display for ExampleEnumSet
Source§impl Hash for ExampleEnumSet
impl Hash for ExampleEnumSet
Source§impl LowerExp for ExampleEnumSet
impl LowerExp for ExampleEnumSet
Source§impl LowerHex for ExampleEnumSet
impl LowerHex for ExampleEnumSet
Source§impl Octal for ExampleEnumSet
impl Octal for ExampleEnumSet
Source§impl Ord for ExampleEnumSet
impl Ord for ExampleEnumSet
Source§fn cmp(&self, other: &ExampleEnumSet) -> Ordering
fn cmp(&self, other: &ExampleEnumSet) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ExampleEnumSet
impl PartialEq for ExampleEnumSet
Source§impl PartialOrd for ExampleEnumSet
impl PartialOrd for ExampleEnumSet
Source§impl UpperExp for ExampleEnumSet
impl UpperExp for ExampleEnumSet
Source§impl UpperHex for ExampleEnumSet
impl UpperHex for ExampleEnumSet
impl Copy for ExampleEnumSet
impl Eq for ExampleEnumSet
impl StructuralPartialEq for ExampleEnumSet
Auto Trait Implementations§
impl Freeze for ExampleEnumSet
impl RefUnwindSafe for ExampleEnumSet
impl Send for ExampleEnumSet
impl Sync for ExampleEnumSet
impl Unpin for ExampleEnumSet
impl UnwindSafe for ExampleEnumSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more