Crates.io | bytes_convert |
lib.rs | bytes_convert |
version | 1.0.0 |
source | src |
created_at | 2023-07-29 12:59:03.840091 |
updated_at | 2023-07-29 12:59:03.840091 |
description | Easily encode and decode bytes to send data over network |
homepage | |
repository | https://github.com/positiveway/bytes_convert |
max_upload_size | |
id | 929235 |
size | 5,528 |
Easily encode and decode bytes to send data over network
Add to Cargo.toml
bytes_convert = "1.0.0"
To use the latest development version:
bytes_convert = { git = "https://github.com/positiveway/bytes_convert", branch = "main" }
use bytes_convert::{to_bytes, from_bytes};
fn main() {
let input_data = &[-2i16, -7, 9, 31];
let converted_bytes = to_bytes(input_data);
println!("{}", converted_bytes.len());
//convert back to original data
let original_data: Vec<i16> = from_bytes(converted_bytes);
for item in &original_data {
println!("{}", item)
};
}