Crate uberbyte

Source
Expand description

Bit manipulation for dummies

A easy to use utility for bit manipulation

use uberbyte::UberByte;

fn main() {
    let my_byte: UberByte = UberByte::from(42);

    println!("{:b}", my_byte);
    for index in 0..7 {
        if my_byte.is_bit_set(index) {
            println!("Bit on position {} is set", index);
        } else {
            println!("Bit on position {} is not set", index);
        }
    }
}

§Additional resources

Additional resources are available at (GitHub project page)[https://github.com/dejanfajfar/uberbyte.rs]

Re-exports§

pub use uberbyte::*;

Modules§

uberbyte

Enums§

UberByteError
Defines the possible errors that can happen inside the UberByte crate

Constants§

ALL_BIT_MASK
Defines the 0 bit bit mask bin: 1111 1111 dec: 255 oct: 377 hex: ff
FIFTH_BIT_MASK
Defines the 5 bit bit mask bin: 0010 0000 dec: 32 oct: 40 hex: 20
FIRST_BIT_MASK
Defines the 1 bit bit mask bin: 0000 0010 dec: 2 oct: 2 hex: 2
FOURTH_BIT_MASK
Defines the 4 bit bit mask bin: 0001 0000 dec: 16 oct: 20 hex: 10
NONE_BIT_MASK
Defines the 0 bit bit mask bin: 0000 0000 dec: 0 oct: 0 hex: 0
SECOND_BIT_MASK
Defines the 2 bit bit mask bin: 0000 0100 dec: 4 oct: 4 hex: 4
SEVENTH_BIT_MASK
Defines the 0 bit bit mask bin: 1000 0000 dec: 128 oct: 200 hex: 80
SIXTH_BIT_MASK
Defines the 6 bit bit mask bin: 0100 0000 dec: 64 oct: 100 hex: 40
THIRD_BIT_MASK
Defines the 3 bit bit mask bin: 0000 1000 dec: 8 oct: 10 hex: 8
ZERO_BIT_MASK
Defines the 0 bit bit mask bin: 0000 0001 dec: 1 oct: 1 hex: 1