[][src]Crate mmap_safe

This library provides a thin wrapper around the memmap crate in order to make file-backed mapped memory safe in Rust. Although the crate tries it's best at ensuring safety, this can not be fully guaranteed.

Safe and Unsafe usage

Since Linux and other Unix-Systems currently do not provide mandatory file locks (Linux does but it's buggy and will be removed in the future), it is not possible to prevent parallel access to a certain file. Therefore file-backed mapped memory is inherently unsafe.

However, if you access a file only through this library and not through the std::fs::File API, you are safe. This crate uses an advisory lock internally to make sure only one MappedFile instance ever exists at the same time for the same file.

Oh, and don't use it on network filesystems, I haven't tested that.

Structs

IntoMutMapping

Mutably mapped file obtained by MappedFile::into_mut_mapping().

MappedFile

A thin, safe wrapper for memory-mapped files.

Mapping

A file mapped to memory.

MutMapping

A file mutably mapped to memory.