Skip to main content

BitTest

Trait BitTest 

Source
pub trait BitTest {
    // Required methods
    fn bits(&self) -> usize;
    fn bit(&self, position: usize) -> bool;
    fn trailing_zeros(&self) -> usize;
}
Expand description

This trait support unified bit testing for (unsigned) integers

Required Methods§

Source

fn bits(&self) -> usize

Get the minimum required number of bits to represent this integer

Source

fn bit(&self, position: usize) -> bool

Get the i-th bit of the integer, with i specified by position

Source

fn trailing_zeros(&self) -> usize

Get the number of trailing zeros in the integer

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl BitTest for BigUint

Available on crate feature num-bigint only.
Source§

fn bit(&self, position: usize) -> bool

Source§

fn bits(&self) -> usize

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for u8

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for u16

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for u32

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for u64

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for u128

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Source§

impl BitTest for usize

Source§

fn bits(&self) -> usize

Source§

fn bit(&self, position: usize) -> bool

Source§

fn trailing_zeros(&self) -> usize

Implementors§

Source§

impl<T: Integer + Clone + BitTest, R: Reducer<T>> BitTest for Mint<T, R>