pub trait HighestOne: Sized {
// Required method
fn highest_one(self) -> Option<u32>;
}Expand description
Finds the index of the highest one-bit.
Required Methods§
Sourcefn highest_one(self) -> Option<u32>
fn highest_one(self) -> Option<u32>
Returns the index of the highest bit set to one, or None if the
value is zero.
use const_num_traits::HighestOne;
assert_eq!(HighestOne::highest_one(0b0101_0000u8), Some(6));
assert_eq!(HighestOne::highest_one(0u8), None);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".