Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hokim98/byte-array
A library that supports Java-like series processing with byteorder.
https://github.com/hokim98/byte-array
Last synced: about 7 hours ago
JSON representation
A library that supports Java-like series processing with byteorder.
- Host: GitHub
- URL: https://github.com/hokim98/byte-array
- Owner: HoKim98
- License: mit
- Created: 2019-03-09T18:11:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-13T06:55:26.000Z (over 1 year ago)
- Last Synced: 2024-10-28T22:30:53.369Z (19 days ago)
- Language: Rust
- Size: 14.6 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ByteArray
[![Version](https://docs.rs/byte_array/badge.svg)](https://crates.io/crates/byte_array) \
A library that supports `Java`-like series processing.
This is useful when you already know the format of your data.
On the other hand, the processing of invalid data is relatively poor,
so it is not recommended to use it for uncertain data.# Installation
```toml
[dependencies]
byte_array = "0.1"
```# Usage
```rust
use byte_array::ByteArray;fn main() {
// Create an empty ByteArray
let mut ba = ByteArray::new();
// Input data
let a: f64 = 3.14;
let b: u16 = 1234;
let c: String = String::from("hello");
// Write data to ByteArray
ba.write(&a);
// ( Using Operator <<= )
ba <<= &b;
ba <<= &c;
// Read data from ByteArray
ba.seek_first();
assert_eq!(a, ba.read::()); // 3.14
assert_eq!(b, ba.read_safe::().unwrap()); // 1234
assert_eq!(c, ba.read::()); // "hello"
}
```# Supported Data Types
| Data Type | Supported |
|--------------:|:---------:|
| bool | Yes |
| u8 | Yes |
| u16 | Yes |
| u32 | Yes |
| u64 | Yes |
| u128 | Yes |
| i8 | Yes |
| i16 | Yes |
| i32 | Yes |
| i64 | Yes |
| i128 | Yes |
| f32 | Yes |
| f64 | Yes |
|---------------|-----------|
| usize as u64 | Yes |
| isize as i64 | Yes |
|---------------|-----------|
| Vec | Yes |
| String | Yes |
| ByteArray | Yes |
| User-Defined | Optional |# Documentation
[Docs.rs](https://docs.rs/byte_array)# License
Distributed under MIT License since 2019.