Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jezza/in-out
A simple library to read and write bytes in various forms.
https://github.com/jezza/in-out
Last synced: 7 days ago
JSON representation
A simple library to read and write bytes in various forms.
- Host: GitHub
- URL: https://github.com/jezza/in-out
- Owner: Jezza
- License: mit
- Created: 2022-02-23T12:18:20.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T12:41:28.000Z (over 2 years ago)
- Last Synced: 2024-10-31T09:09:39.150Z (8 days ago)
- Language: Rust
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# in-out
A very simple, straightforward library for reading and writing bytes.
### Usage
```rust
use in_out::Input;// Some data source... Could be a vec, array, etc
let data = vec![0xDE, 0xAD, 0xBE, 0xEF, 2, 0b0000_0001];let mut input = Input::new(&data);
let magic = input.try_read_u32_be()
.expect("Unable to read Magic Number...");
let version = input.read_u8();
let flags = input.read_u8();// Prints "0xDEADBEEF v2 flags:00000001"
println!("0x{:X} v{} flags:{:08b}", magic, version, flags);
```