Import 'bit_field' crate

Request Document: go/android-rust-importing-crates
For CL Reviewers: go/android3p#cl-review
For Build Team: go/ab-third-party-imports
Bug: http://b/326114231
Test: m <Crate Library>

Change-Id: I4f79ba9b2ae524f3d918762079dca91a56fcf62f
16 files changed
tree: 401a79a5f81a945cb701767d6262c5576b5910af
  1. benches/
  2. src/
  3. .cargo_vcs_info.json
  4. .gitignore
  5. .travis.yml
  6. Cargo.toml
  7. Cargo.toml.orig
  8. Changelog.md
  9. LICENSE
  10. LICENSE-APACHE
  11. LICENSE-MIT
  12. METADATA
  13. MODULE_LICENSE_APACHE2
  14. OWNERS
  15. README.md
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.