Skip to main content

LowestOne

Trait LowestOne 

Source
pub trait LowestOne: Sized {
    // Required method
    fn lowest_one(self) -> Option<u32>;
}
Expand description

Finds the index of the lowest one-bit.

Required Methods§

Source

fn lowest_one(self) -> Option<u32>

Returns the index of the lowest bit set to one, or None if the value is zero.

use const_num_traits::LowestOne;

assert_eq!(LowestOne::lowest_one(0b0101_0000u8), Some(4));
assert_eq!(LowestOne::lowest_one(0u8), None);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl LowestOne for i8

Source§

impl LowestOne for i16

Source§

impl LowestOne for i32

Source§

impl LowestOne for i64

Source§

impl LowestOne for i128

Source§

impl LowestOne for isize

Source§

impl LowestOne for u8

Source§

impl LowestOne for u16

Source§

impl LowestOne for u32

Source§

impl LowestOne for u64

Source§

impl LowestOne for u128

Source§

impl LowestOne for usize

Implementors§