Struct std::os::MemoryMap
pub struct MemoryMap { data: *mut u8, len: uint, kind: MemoryMapKind, }
A memory mapped file or chunk of memory. This is a very system-specific
interface to the OS's memory mapping facilities (mmap
on POSIX,
VirtualAlloc
/CreateFileMapping
on win32). It makes no attempt at
abstracting platform differences, besides in error values returned. Consider
yourself warned.
The memory map is released (unmapped) when the destructor is run, so don't let it leave scope by accident if you want it to stick around.
Fields
data | Pointer to the memory created or modified by this map. |
len | Number of bytes this map applies to |
kind | Type of mapping |
Methods
impl MemoryMap
fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
Create a new mapping with the given options
, at least min_len
bytes
long. min_len
must be greater than zero; see the note on
ErrZeroLength
.
fn granularity() -> uint
Granularity that the offset or address must be for MapOffset
and
MapAddr
respectively.
Trait Implementations
impl Drop for MemoryMap
fn drop(&mut self)
Unmap the mapping. Fails the task if munmap
fails.