tree: 7035590beb6c33c8aec693c955cac59c0cc288c0 [path history] [tgz]
  1. benches/
  2. src/
  3. .android-checksum.json
  4. .cargo-checksum.json
  5. Android.bp
  6. Cargo.toml
  7. cargo_embargo.json
  8. Changelog.md
  9. LICENSE-APACHE
  10. LICENSE-MIT
  11. METADATA
  12. MODULE_LICENSE_APACHE2
  13. README.md
  14. rules.mk
crates/bit_field/README.md

bit_field

A simple crate which provides the BitField trait, which provides methods for operating on individual bits and ranges of bits on Rust's integral types.

Documentation

Documentation is available on docs.rs

Usage

[dependencies]
bit_field = "0.10.1"

Example

extern crate bit_field;
use bit_field::BitField;

let mut x: u8 = 0;

x.set_bit(7, true);
assert_eq!(x, 0b1000_0000);

x.set_bits(0..4, 0b1001);
assert_eq!(x, 0b1000_1001);

License

This crate is dual-licensed under MIT or the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.