https://github.com/danaozhong/rust-bitwriter
rust library to write integer types of any bit length into a buffer - from `i1` to `i64`.
https://github.com/danaozhong/rust-bitwriter
bitbanging bitbuffer bitwriter bytebuffer int15 int4 rust
Last synced: 10 months ago
JSON representation
rust library to write integer types of any bit length into a buffer - from `i1` to `i64`.
- Host: GitHub
- URL: https://github.com/danaozhong/rust-bitwriter
- Owner: Danaozhong
- License: mit
- Created: 2023-01-09T06:44:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T04:38:20.000Z (almost 2 years ago)
- Last Synced: 2025-08-24T16:59:14.415Z (10 months ago)
- Topics: bitbanging, bitbuffer, bitwriter, bytebuffer, int15, int4, rust
- Language: Rust
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-bitwriter
`rust-bitwriter` is a rust crate to write data into a bit stream.

This example shows how to write a `bool`, an `u28` and an `i28` into a byte vector:
```rust
let mut writer = BitWriter::new();
writer.write_bool(true).expect("failed to write bool");
writer.write_u32(178956970, 28).expect("failed to write u28");
writer.write_i32(-22369622, 28).expect("failed to write i28");
writer.close().expect("failed to close byte vector");
let buffer = writer.data();
```
You can write signed and unsigned integers with 1-64 bit length.
It is intended to complement [irauta/bitreader](https://github.com/irauta/bitreader) with a writer component.
This is my first rust project, so there might be some issues. If you have some suggestions or improvements, please feel welcomed to raise a PR!
## License
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.