Expand description
PKBuffer is a library built for arbitrary casting of data structures onto segments of memory! This includes sections of unowned memory, such as examining the headers of a currently running executable. It creates an interface for reading and writing data structures to an arbitrary buffer of bytes.
For example:
use pkbuffer::VecBuffer;
#[repr(packed)]
struct Object {
byte: u8,
word: u16,
dword: u32,
}
let mut buffer = VecBuffer::with_initial_size(std::mem::size_of::<Object>());
let object = buffer.get_mut_ref::<Object>(0).unwrap();
object.byte = 0x01;
object.word = 0x0302;
object.dword = 0x07060504;
assert_eq!(buffer, [1,2,3,4,5,6,7]);The buffer comes in two forms: pointer form (Buffer) and
allocated form (VecBuffer). Each of these structures come
in handy for different reasons. Buffer’s extra implementations
are based on the slice object, whereas VecBuffer’s
extra implementations are based on the Vec object.
Structs
The core buffer object which handles the majority of buffer-like interactions.
An iterator for a Buffer object.
A mutable iterator for a Buffer object.
Enums
Errors produced by the library.