pub struct ExampleBitfield { /* private fields */ }
doc
or test
) and crate feature _bit_u8
only.Expand description
An example created with bitfield!
, everything public.
use devela::bitfield;
bitfield! {
/// An example created with [`bitfield!`], everything public.
pub struct ExampleBitfield(u8) {
/// Documentation for the first field.
FLAG1: 0;
/// Documentation for the second field.
FLAG2: 1;
MASK: 0, 1;
}
}
let mut b = ExampleBitfield::with_field_mask();
assert![b.is_field_mask()];
assert![b.is_field_flag1()];
assert![b.is_field_flag2()];
let _c = b.unset_field_flag1();
Implementations§
Source§impl ExampleBitfield
§Custom fields operations
impl ExampleBitfield
§Custom fields operations
Sourcepub const fn without_fields() -> Self
pub const fn without_fields() -> Self
Returns a new ExampleBitfield
with none of the fields set.
Sourcepub const fn with_all_fields() -> Self
pub const fn with_all_fields() -> Self
Returns a new ExampleBitfield
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 ExampleBitfield
§FLAG1
single field operations
impl ExampleBitfield
§FLAG1
single field operations
Sourcepub const fn with_field_flag1() -> Self
pub const fn with_field_flag1() -> Self
Returns a new ExampleBitfield
with FLAG1
field set.
Sourcepub const fn is_field_flag1(self) -> bool
pub const fn is_field_flag1(self) -> bool
Whether the FLAG1
field is set.
Sourcepub const fn bits_field_flag1(self) -> u32 ⓘ
pub const fn bits_field_flag1(self) -> u32 ⓘ
The size in bits of the FLAG1
field.
Sourcepub const fn get_field_flag1(self) -> Self
pub const fn get_field_flag1(self) -> Self
A copy of self
with only the bits of FLAG1
field.
Sourcepub const fn set_field_flag1(self) -> Self
pub const fn set_field_flag1(self) -> Self
A copy of self
with the FLAG1
field set.
Sourcepub fn mut_set_field_flag1(&mut self)
pub fn mut_set_field_flag1(&mut self)
Sets the FLAG1
field.
Sourcepub const fn get_field_value_flag1(self) -> Self
pub const fn get_field_value_flag1(self) -> Self
The value at the bit range of FLAG1
field.
Sourcepub const fn set_field_value_flag1(self, value: u8) -> Self
pub const fn set_field_value_flag1(self, value: u8) -> Self
Sets the value
into the bitrange of FLAG1
field.
Sourcepub const fn unset_field_flag1(self) -> Self
pub const fn unset_field_flag1(self) -> Self
A copy of self
with the FLAG1
field set.
Sourcepub fn mut_unset_field_flag1(&mut self)
pub fn mut_unset_field_flag1(&mut self)
Unsets the FLAG1
field.
Sourcepub const fn flip_field_flag1(self) -> Self
pub const fn flip_field_flag1(self) -> Self
Returns a copy of self
with the FLAG1
field flipped.
Sourcepub fn mut_flip_field_flag1(&mut self)
pub fn mut_flip_field_flag1(&mut self)
Flips the FLAG1
field.
Source§impl ExampleBitfield
§FLAG2
single field operations
impl ExampleBitfield
§FLAG2
single field operations
Sourcepub const fn with_field_flag2() -> Self
pub const fn with_field_flag2() -> Self
Returns a new ExampleBitfield
with FLAG2
field set.
Sourcepub const fn is_field_flag2(self) -> bool
pub const fn is_field_flag2(self) -> bool
Whether the FLAG2
field is set.
Sourcepub const fn bits_field_flag2(self) -> u32 ⓘ
pub const fn bits_field_flag2(self) -> u32 ⓘ
The size in bits of the FLAG2
field.
Sourcepub const fn get_field_flag2(self) -> Self
pub const fn get_field_flag2(self) -> Self
A copy of self
with only the bits of FLAG2
field.
Sourcepub const fn set_field_flag2(self) -> Self
pub const fn set_field_flag2(self) -> Self
A copy of self
with the FLAG2
field set.
Sourcepub fn mut_set_field_flag2(&mut self)
pub fn mut_set_field_flag2(&mut self)
Sets the FLAG2
field.
Sourcepub const fn get_field_value_flag2(self) -> Self
pub const fn get_field_value_flag2(self) -> Self
The value at the bit range of FLAG2
field.
Sourcepub const fn set_field_value_flag2(self, value: u8) -> Self
pub const fn set_field_value_flag2(self, value: u8) -> Self
Sets the value
into the bitrange of FLAG2
field.
Sourcepub const fn unset_field_flag2(self) -> Self
pub const fn unset_field_flag2(self) -> Self
A copy of self
with the FLAG2
field set.
Sourcepub fn mut_unset_field_flag2(&mut self)
pub fn mut_unset_field_flag2(&mut self)
Unsets the FLAG2
field.
Sourcepub const fn flip_field_flag2(self) -> Self
pub const fn flip_field_flag2(self) -> Self
Returns a copy of self
with the FLAG2
field flipped.
Sourcepub fn mut_flip_field_flag2(&mut self)
pub fn mut_flip_field_flag2(&mut self)
Flips the FLAG2
field.
Source§impl ExampleBitfield
§MASK0
single field operations
impl ExampleBitfield
§MASK0
single field operations
Sourcepub const fn with_field_mask0() -> Self
pub const fn with_field_mask0() -> Self
Returns a new ExampleBitfield
with MASK0
field set.
Sourcepub const fn is_field_mask0(self) -> bool
pub const fn is_field_mask0(self) -> bool
Whether the MASK0
field is set.
Sourcepub const fn bits_field_mask0(self) -> u32 ⓘ
pub const fn bits_field_mask0(self) -> u32 ⓘ
The size in bits of the MASK0
field.
Sourcepub const fn get_field_mask0(self) -> Self
pub const fn get_field_mask0(self) -> Self
A copy of self
with only the bits of MASK0
field.
Sourcepub const fn set_field_mask0(self) -> Self
pub const fn set_field_mask0(self) -> Self
A copy of self
with the MASK0
field set.
Sourcepub fn mut_set_field_mask0(&mut self)
pub fn mut_set_field_mask0(&mut self)
Sets the MASK0
field.
Sourcepub const fn get_field_value_mask0(self) -> Self
pub const fn get_field_value_mask0(self) -> Self
The value at the bit range of MASK0
field.
Sourcepub const fn set_field_value_mask0(self, value: u8) -> Self
pub const fn set_field_value_mask0(self, value: u8) -> Self
Sets the value
into the bitrange of MASK0
field.
Sourcepub const fn unset_field_mask0(self) -> Self
pub const fn unset_field_mask0(self) -> Self
A copy of self
with the MASK0
field set.
Sourcepub fn mut_unset_field_mask0(&mut self)
pub fn mut_unset_field_mask0(&mut self)
Unsets the MASK0
field.
Sourcepub const fn flip_field_mask0(self) -> Self
pub const fn flip_field_mask0(self) -> Self
Returns a copy of self
with the MASK0
field flipped.
Sourcepub fn mut_flip_field_mask0(&mut self)
pub fn mut_flip_field_mask0(&mut self)
Flips the MASK0
field.
Source§impl ExampleBitfield
§General bits manipulation functionality
impl ExampleBitfield
§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 ExampleBitfield
§Bit ranges
impl ExampleBitfield
§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 ExampleBitfield
§Bit masks
impl ExampleBitfield
§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 ExampleBitfield
impl Binary for ExampleBitfield
Source§impl Clone for ExampleBitfield
impl Clone for ExampleBitfield
Source§fn clone(&self) -> ExampleBitfield
fn clone(&self) -> ExampleBitfield
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ExampleBitfield
impl Debug for ExampleBitfield
Source§impl Default for ExampleBitfield
impl Default for ExampleBitfield
Source§impl Display for ExampleBitfield
impl Display for ExampleBitfield
Source§impl Hash for ExampleBitfield
impl Hash for ExampleBitfield
Source§impl LowerExp for ExampleBitfield
impl LowerExp for ExampleBitfield
Source§impl LowerHex for ExampleBitfield
impl LowerHex for ExampleBitfield
Source§impl Octal for ExampleBitfield
impl Octal for ExampleBitfield
Source§impl Ord for ExampleBitfield
impl Ord for ExampleBitfield
Source§fn cmp(&self, other: &ExampleBitfield) -> Ordering
fn cmp(&self, other: &ExampleBitfield) -> 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 ExampleBitfield
impl PartialEq for ExampleBitfield
Source§impl PartialOrd for ExampleBitfield
impl PartialOrd for ExampleBitfield
Source§impl UpperExp for ExampleBitfield
impl UpperExp for ExampleBitfield
Source§impl UpperHex for ExampleBitfield
impl UpperHex for ExampleBitfield
impl Copy for ExampleBitfield
impl Eq for ExampleBitfield
impl StructuralPartialEq for ExampleBitfield
Auto Trait Implementations§
impl Freeze for ExampleBitfield
impl RefUnwindSafe for ExampleBitfield
impl Send for ExampleBitfield
impl Sync for ExampleBitfield
impl Unpin for ExampleBitfield
impl UnwindSafe for ExampleBitfield
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