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 bytesconvert::{tobytes, from_bytes};
fn main() { let inputdata = &[-2i16, -7, 9, 31]; let convertedbytes = tobytes(inputdata); 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)
};
} ```