1 unstable release
Uses old Rust 2015
0.1.0 | Aug 28, 2017 |
---|
#21 in #bitmask
4KB
77 lines
pretty_bit_mask
All this does is make bit masking operations a bit prettier.
Example
let mut n = 0;
let m = 1;
n |= m; // apply mask m normally
n.mask(m); // apply mask m prettily
assert!(n & m == m); // check if mask m has been applied normally
assert!(n.masked(m)); // check if mask m has been applied prettily
n &= !m; // unmask mask m normally
n.unmask(m); // unmask mask m prettily
n ^= m; // flip mask m normally
n.flip(m); // flip mask m prettily
Typing out the pretty version takes a tad longer, but it can help make one's code clearer.
lib.rs
:
All this crate does is make bit masking operations a bit prettier.