bittersweet

Crates.io codecov License

Bittersweet is a library for bit manipulation.

Motivation

Bit-wise operations are often used in low-level programming and it sometimes contains magical bugs. I want to manipulate bits with more - type-safe - well-tested - well-documented - fast and efficient

Usage

Installation

You can install this library via cargo.

sh $ cargo add bittersweet

Or you can add this to your Cargo.toml manually.

Example

rust use bittersweet::bitline::{Bitline, Bitline8}; fn main() { let t = 0b00111000_u8 as Bitline8; if t.includes(0b00110000_u8) { println!("Yes!"); } }

Supported bitline length

Following Bitline traits are implemented for u8, u16, u32, u64, u128. So these operations keep zero-cost abstraction.

Documentation

See docs.rs

Manipulations

https://docs.rs/bittersweet/latest/bittersweet/bitline/trait.Bitline.html

License

BSD-3-Clause