Crates.io | bitstr |
lib.rs | bitstr |
version | 0.1.2 |
source | src |
created_at | 2022-09-23 11:46:39.31696 |
updated_at | 2022-09-23 22:01:42.612937 |
description | BitStr is a contiguous sequence of bits in memory |
homepage | |
repository | https://github.com/raphamorim/bitstr |
max_upload_size | |
id | 672429 |
size | 269,069 |
bitstr is just that: a sequence of bytes. It isn't human-readable. Under the hood, everything must be converted to a byte string before it can be stored in a computer.
Which means that a bitstring is a contiguous sequence of bits in memory.
// 1.
let bytes = [82, 105, 111];
let bit: &BitStr = BitStr::from(&bytes);
// 2.
let bytes = b"Rust";
let bit: &BitStr = BitStr::from(bytes);
// 3.
let bit: &BitStr = BitStr::from(b"My sequence of bytes");
let op = bit.contains([82, 105, 111]); // false
// 4.
let bit: &BitStr = BitStr::from(b"Rio");
let op = bit.contains_u8(82); // true