Trait BitOps

Source
pub trait BitOps {
    // Required methods
    fn get_bit(&self, n: u8) -> bool;
    fn set_bit(&self, n: usize, value: bool) -> u8;
    fn set_lsb(&self, value: bool) -> Self;
    fn get_lsb(&self) -> bool;
}

Required Methods§

Source

fn get_bit(&self, n: u8) -> bool

Returns the bit on the specified position.

Source

fn set_bit(&self, n: usize, value: bool) -> u8

Sets a bit on the specified position.

Source

fn set_lsb(&self, value: bool) -> Self

Sets the least significant bit of a number according to the passed value.

Source

fn get_lsb(&self) -> bool

Returns the least significant bit.

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.

Implementations on Foreign Types§

Source§

impl BitOps for u8

Source§

fn get_bit(&self, n: u8) -> bool

Source§

fn set_bit(&self, n: usize, value: bool) -> u8

Source§

fn set_lsb(&self, value: bool) -> u8

Source§

fn get_lsb(&self) -> bool

Implementors§