pretty_bit_mask 0.1.0

All this does is make bit masking operations a bit prettier.
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 4.68 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.15 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • TurkeyMcMac/pretty_bit_mask
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • TurkeyMcMac

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.