crumbles 0.1.0

Keeping track of your pie's crumbles
Documentation

Library for creating and managing [MEM_SIZE] bytes copy-on-write memory-mapped regions.

The core functionality is offered by the [Mmap] struct, which is a read-write memory region that keeps track of which pages have been written to.

Each Mmap is MEM_SIZE in size, and can be backed by physical memory, a set of files, or a combination of both. Each page is [PAGE_SIZE] in size, meaning that each mmap contains 65536 pages.

Example

# use std::io;
# fn main() -> io::Result<()> {
use crumbles::Mmap;

let mut mmap = Mmap::new()?;

// When first created, the mmap is not dirty.
assert_eq!(mmap.dirty_pages().count(), 0);

mmap[24] = 42;
// After writing a single byte, the page it's on is dirty.
assert_eq!(mmap.dirty_pages().count(), 1);
# Ok(())
# }

Limitations

This crate currently only builds for 64-bit Unix targets. This is because it relies on various features of libc which are not available in other targets.