[−][src]Crate bit_op
Bit Op
This crate provide you constant for each bit of each unsigned type.
And if you import BitOp
trait you can call set
, reset
, toggle
, get
on all unsigned integers
Basic usage:
use bit_op::BitOp; use bit_op::bit_u8::B0 as HELLO; use bit_op::bit_u8::B1 as WORLD; let mut config: u8 = 0; config.set(HELLO); config.set(WORLD); let mut output = String::new(); if config.get(HELLO) != 0 { output += "Hello "; } if config.get(WORLD) != 0 { output += "World!"; } assert_eq!(output, "Hello World!");
Modules
bit_u8 | Definitions of constants for each bit of u8 |
bit_u16 | Definitions of constants for each bit of u16 |
bit_u32 | Definitions of constants for each bit of u32 |
bit_u64 | Definitions of constants for each bit of u64 |
bit_u128 | Definitions of constants for each bit of u128 |
Traits
BitOp |