Crates.io | fuel-data-parser |
lib.rs | fuel-data-parser |
version | 0.0.13 |
source | src |
created_at | 2024-08-24 06:16:37.763671 |
updated_at | 2024-11-28 02:50:42.611714 |
description | A parser for Fuel blockchain data structures and formats |
homepage | https://fuel.network/ |
repository | https://github.com/fuellabs/data-systems |
max_upload_size | |
id | 1349848 |
size | 25,554 |
The DataParser
struct provides functionality for encoding and decoding data through compression and serialization. It offers flexibility in choosing compression strategies and serialization formats, allowing for optimization of memory usage and I/O bandwidth. This utility is particularly useful when dealing with large datasets or when efficient data transfer is crucial.
This library is intended for internal use within the Fuel Data Systems project. This is an example of usage outside of this crate within the project:
use fuel_data_parser::{DataParser, SerializationType, DataParseable};
use serde::{Serialize, Deserialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
struct YourDataType {
// Your data fields here
}
async fn example_usage() -> Result<(), Box<dyn std::error::Error>> {
let parser = DataParser::default()
.with_serialization_type(SerializationType::Bincode);
// Encoding data
let data = YourDataType { /* ... */ };
let encoded = parser.encode(&data).await?;
// Decoding data
let decoded: YourDataType = parser.decode(&encoded).await?;
Ok(())
}
To run the benchmarks and measure performance of different serialization and compression strategies:
cargo bench -p data-parser -p nats-publisher -p bench-consumers
[!INFO] The benchmarks are located in the
../../benches
folder.
Contributions are welcome! Please feel free to submit a Pull Request.
For more information on contributing, please see the CONTRIBUTING.md file in the root of the repository.
This repo is licensed under the Apache-2.0
license. See LICENSE
for more information.