bin_buffer

Crates.iobin_buffer
lib.rsbin_buffer
version0.1.12
sourcesrc
created_at2020-03-10 11:43:35.919229
updated_at2022-11-18 14:31:30.040199
descriptionA simple library for writing objects to binairy buffers.
homepage
repositoryhttps://gitlab.com/codybloemhard/bin-buffer
max_upload_size
id217234
size24,372
Cody Bloemhard (codybloemhard)

documentation

README

docs

BinBuffer

Simple lightweight crate for translating objects into binairy buffers. It supports reading and writing these types: u64, u32, u16, u8, f64, f32, (f64,f64), String, Vec<Bufferable + Clone>, (U,V), (U,V,W), (U,V,W,X) where U,V,W are Bufferable. This is a simple crate to read and write binairy data.

Example:

use bin_buffer::*;
let x = 16u16;
let y = String::from("hello");
let z = (0.0001f64,1.1111f64);
let mut buffer = Vec::new();
x.into_buffer(&mut buffer);
y.copy_into_buffer(&mut buffer);
z.into_buffer(&mut buffer);
let mut buffer = ReadBuffer::from_raw(buffer);
assert_eq!(Some(x), u16::from_buffer(&mut buffer));
assert_eq!(Some(y), String::from_buffer(&mut buffer));
assert_eq!(Some(z), <(f64,f64)>::from_buffer(&mut buffer));
Commit count: 32

cargo fmt