mmap wrapper
a simple wrapper for the memmap2 crate to cast mmap backed pointers to structs.
Example
a common use case for mmaps in C is to cast the mmap backed pointer to a struct such as:
MyStruct* mmap_backed_mystruct;
int fd;
fd = ;
;
mmap_backed_mystruct = ;
this is a helpful wrapper for this use case:
use MmapWrapper;
// structs musthave a well defined layout,
// generally want them to be transparent or repr(C)
let f = options
.read
.write
.create
.truncate
.open
.unwrap;
let _ = f.set_len;
let m = unsafe ;
let m_wrapper = new;
let mmap_backed_mystruct = unsafe ;