intbits 0.2.0

Easy access to individual bits of integers
Documentation
  • Coverage
  • 100%
    15 out of 15 items documented9 out of 15 items with examples
  • Size
  • Source code size: 14.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.29 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • m-ou-se/intbits
    51 5 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • m-ou-se

intbits

Easy access to individual bits of integers

use intbits::Bits;

assert_eq!(2.bit(0), false);
assert_eq!(2.bit(1), true);
assert_eq!(2.bit(2), false);

assert_eq!(0b1011u32.bits(0..2), 0b11);
assert_eq!(0b1011u32.bits(2..4), 0b10);

assert_eq!(0xFFu8.with_bit(3, false), 0xF7);
assert_eq!(0xFFu8.with_bits(4..8, 3), 0x3F);

See the documentation.