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

Modules

Enums

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

Constants

  • Defines the 0 bit bit mask bin: 1111 1111 dec: 255 oct: 377 hex: ff
  • Defines the 5 bit bit mask bin: 0010 0000 dec: 32 oct: 40 hex: 20
  • Defines the 1 bit bit mask bin: 0000 0010 dec: 2 oct: 2 hex: 2
  • Defines the 4 bit bit mask bin: 0001 0000 dec: 16 oct: 20 hex: 10
  • Defines the 0 bit bit mask bin: 0000 0000 dec: 0 oct: 0 hex: 0
  • Defines the 2 bit bit mask bin: 0000 0100 dec: 4 oct: 4 hex: 4
  • Defines the 0 bit bit mask bin: 1000 0000 dec: 128 oct: 200 hex: 80
  • Defines the 6 bit bit mask bin: 0100 0000 dec: 64 oct: 100 hex: 40
  • Defines the 3 bit bit mask bin: 0000 1000 dec: 8 oct: 10 hex: 8
  • Defines the 0 bit bit mask bin: 0000 0001 dec: 1 oct: 1 hex: 1