muscleman-0.2.0 has been yanked.
muscleman
muscleman is a library for creating and managing buffers. It gets its name from the fact that it is a buffer manager.
And thinking of "buff" as in "buff body", it is a library for managing buffers of data. Plus, muscle man is a funny character.
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
And this to your crate root:
extern crate muscleman;
use Buffer;
Examples
Creating a buffer
use buffer;
let mut buffer = new;
buffer.write_byte;
buffer.write_byte;
assert_eq!;
Writing to a buffer
use buffer;
let mut buffer = new;
// 8 to 64 bit signed integers
buffer.write_i8;
buffer.write_i16;
buffer.write_i32;
buffer.write_i64;
// 8 to 64 bit unsigned integers
buffer.write_u8;
buffer.write_u16;
buffer.write_u32;
buffer.write_u64;
// 32 and 64 bit floating point numbers
buffer.write_f32;
buffer.write_f64;
// Null terminated strings and length prefixed strings
buffer.write_string;
buffer.write_string_with_length; // The length is written as a u32
Reading from a buffer
use buffer;
let mut buffer = new;
// Assume the data in the "Writing to a buffer" is currently in the buffer
// 8 to 64 bit signed integers
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// 8 to 64 bit unsigned integers
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// 32 and 64 bit floating point numbers
assert_eq!;
assert_eq!;
// Null terminated strings and length prefixed strings
assert_eq!;
assert_eq!;
Why?
I was working on a project that required me to send and receive data from a server. I needed a way to easily write and read data to and from a buffer. I looked around and found a few crates that did this, but they were either too complicated or didn't do what I needed. So I decided to make my own.
License
muscleman is licensed under the MIT license. See the LICENSE file for more information.