1 unstable release

Uses old Rust 2015

0.1.0 Jun 27, 2018

#9 in #mask

Download history 33/week @ 2023-12-12 27/week @ 2023-12-19 80/week @ 2023-12-26 25/week @ 2024-01-02 94/week @ 2024-01-09 154/week @ 2024-01-16 121/week @ 2024-01-23 428/week @ 2024-01-30 441/week @ 2024-02-06 372/week @ 2024-02-13 236/week @ 2024-02-20 214/week @ 2024-02-27 202/week @ 2024-03-05 188/week @ 2024-03-12 161/week @ 2024-03-19 213/week @ 2024-03-26

789 downloads per month
Used in 2 crates (via radiotap)

Apache-2.0/MIT

7KB

bitops

crates.io docs.rs

Miscellaneous bit operations for any Integer. See documentation here.

Getting started

Add to your project with

cargo add bitops

or directly editing your Cargo.toml

[dependencies]
bitops = "0.1.0"

Example usage

use bitops::BitOps;

let x = 0b1010_1011_0000_1100; // 0xab0c
let flag = 0b1000;

assert!(flag.is_flag());
assert!(flag.is_bit_set(3));

assert!(x.is_flag_set(flag));
assert_eq!(x.bits_as_int(8, 4), 0xb);

License

Licensed under either of

at your option.


lib.rs:

Miscellaneous bit operations for any Integer.

See the BitOps trait for examples.

Dependencies

~210KB