pub trait BitManip: BitManipInternal {
Show 24 methods
// Provided methods
fn bit(&self, bit_index: Self) -> Self { ... }
fn bit_bool(&self, bit_index: Self) -> bool { ... }
fn b(&self, range: impl AsRange<Self>) -> Self { ... }
fn bits(&self, range: impl AsRange<Self>) -> Self { ... }
fn set_bit(&self, bit_index: Self) -> Self { ... }
fn set_bits(&self, range: impl AsRange<Self>) -> Self { ... }
fn set_bit_assign(&mut self, bit_index: Self) { ... }
fn set_bits_assign(&mut self, range: impl AsRange<Self>) { ... }
fn clear_bit(&self, bit_index: Self) -> Self { ... }
fn clear_bits(&self, range: impl AsRange<Self>) -> Self { ... }
fn clear_bit_assign(&mut self, bit_index: Self) { ... }
fn clear_bits_assign(&mut self, range: impl AsRange<Self>) { ... }
fn toggle_bit(&self, bit_index: Self) -> Self { ... }
fn toggle_bits(&self, range: impl AsRange<Self>) -> Self { ... }
fn toggle_bit_assign(&mut self, bit_index: Self) { ... }
fn toggle_bits_assign(&mut self, range: impl AsRange<Self>) { ... }
fn replace_bit(&self, bit_index: Self, value: impl Into<bool>) -> Self { ... }
fn replace_bits(&self, _range: impl AsRange<Self>, _value: Self) -> Self { ... }
fn replace_bit_assign(&mut self, bit_index: Self, value: impl Into<bool>) { ... }
fn replace_bits_assign(&mut self, range: impl AsRange<Self>, value: Self) { ... }
fn bitmask(range: impl AsRange<Self>) -> Self { ... }
fn permute(&self, ranges: &[impl AsRange<Self>]) -> Self { ... }
fn sign_extend_from_bit(&self, bit_index: Self) -> Self { ... }
fn sign_extend_from_size(&self, size: Self) -> Self { ... }
}
Expand description
TODO document
Provided Methods§
Sourcefn bit(&self, bit_index: Self) -> Self
fn bit(&self, bit_index: Self) -> Self
Extracts the bit at the given index from the integer
§Examples
use quickbits::BitManip;
assert_eq!(0b1010_1010.bit(5), 1);
assert_eq!(0b1010_1010.bit(6), 0);
Sourcefn bits(&self, range: impl AsRange<Self>) -> Self
fn bits(&self, range: impl AsRange<Self>) -> Self
Extracts the bits in the given range (or at the given index) from the integer
§Examples
use quickbits::BitManip;
assert_eq!(0b1010_1010.bits(3..=0), 0b1010);
assert_eq!(0b1010_1010.bits(7), 1);
Sourcefn set_bit_assign(&mut self, bit_index: Self)
fn set_bit_assign(&mut self, bit_index: Self)
TODO document
Sourcefn set_bits_assign(&mut self, range: impl AsRange<Self>)
fn set_bits_assign(&mut self, range: impl AsRange<Self>)
TODO document
Sourcefn clear_bits(&self, range: impl AsRange<Self>) -> Self
fn clear_bits(&self, range: impl AsRange<Self>) -> Self
TODO document
Sourcefn clear_bit_assign(&mut self, bit_index: Self)
fn clear_bit_assign(&mut self, bit_index: Self)
TODO document
Sourcefn clear_bits_assign(&mut self, range: impl AsRange<Self>)
fn clear_bits_assign(&mut self, range: impl AsRange<Self>)
TODO document
Sourcefn toggle_bit(&self, bit_index: Self) -> Self
fn toggle_bit(&self, bit_index: Self) -> Self
TODO document
Sourcefn toggle_bits(&self, range: impl AsRange<Self>) -> Self
fn toggle_bits(&self, range: impl AsRange<Self>) -> Self
TODO document
Sourcefn toggle_bit_assign(&mut self, bit_index: Self)
fn toggle_bit_assign(&mut self, bit_index: Self)
TODO document
Sourcefn toggle_bits_assign(&mut self, range: impl AsRange<Self>)
fn toggle_bits_assign(&mut self, range: impl AsRange<Self>)
TODO document
Sourcefn replace_bit(&self, bit_index: Self, value: impl Into<bool>) -> Self
fn replace_bit(&self, bit_index: Self, value: impl Into<bool>) -> Self
TODO document
Sourcefn replace_bits(&self, _range: impl AsRange<Self>, _value: Self) -> Self
fn replace_bits(&self, _range: impl AsRange<Self>, _value: Self) -> Self
TODO document
Sourcefn replace_bit_assign(&mut self, bit_index: Self, value: impl Into<bool>)
fn replace_bit_assign(&mut self, bit_index: Self, value: impl Into<bool>)
TODO document
Sourcefn replace_bits_assign(&mut self, range: impl AsRange<Self>, value: Self)
fn replace_bits_assign(&mut self, range: impl AsRange<Self>, value: Self)
TODO document
Sourcefn sign_extend_from_bit(&self, bit_index: Self) -> Self
fn sign_extend_from_bit(&self, bit_index: Self) -> Self
TODO document
Sourcefn sign_extend_from_size(&self, size: Self) -> Self
fn sign_extend_from_size(&self, size: Self) -> Self
TODO document
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.