bitbuffer rust example
use bitbuffer::{BitBuffer, LittleEndian, BitStream, BitRead};
#[derive(BitRead)]
struct ComplexType {
first: u8,
#[size = 15]
second: u16,
third: bool,
}
fn main() {
let bytes = vec![
0b1011_0101, 0b0110_1010, 0b1010_1100, 0b1001_1001,
0b1001_1001, 0b1001_1001, 0b1001_1001, 0b1110_0111
];
let buffer = BitBuffer::new(bytes, LittleEndian);
let mut stream = BitStream::new(buffer);
let value: u8 = stream.read_int(7)?;
let complex: ComplexType = stream.read()?;
}
Are there any code examples left?
New code examples in category Rust
-
Rust 2022-03-27 22:00:04 rust print i8
-
Rust 2022-03-27 14:15:02 rust check if key in hashmap
-
Rust 2022-03-22 13:45:18 rust convert a string (with decimals) to a floating point number.
-
Rust 2022-03-11 20:00:15 creating constants in rust
-
Rust 2022-03-07 01:55:02 hello world in rust
-
Rust 2022-03-03 20:10:04 levenshtein distance
-
Rust 2022-02-24 12:40:24 execution duration
-
Rust 2022-02-20 05:45:02 matching in rust
-
Rust 2022-02-19 17:35:12 rust bitset stack
-
Rust 2022-01-30 18:30:40 rust compile and run