pub struct Mmap { /* private fields */ }
Expand description

A simple struct consisting of a page-aligned pointer to page-aligned and initially-zeroed memory and a length.

Implementations

Construct a new empty instance of Mmap.

Create a new Mmap pointing to at least size bytes of page-aligned accessible memory.

Creates a new Mmap by opening the file located at path and mapping it into memory.

The memory is mapped in read-only mode for the entire file. If portions of the file need to be modified then the region crate can be use to alter permissions of each page.

The memory mapping and the length of the file within the mapping are returned.

Create a new Mmap pointing to accessible_size bytes of page-aligned accessible memory, within a reserved mapping of mapping_size bytes. accessible_size and mapping_size must be native page-size multiples.

Make the memory starting at start and extending for len bytes accessible. start and len must be native page-size multiples and describe a range within self’s reserved memory.

Return the allocated memory as a slice of u8.

Return the allocated memory as a mutable slice of u8.

Return the allocated memory as a pointer to u8.

Return the allocated memory as a mutable pointer to u8.

Return the length of the allocated memory.

Return whether any memory has been allocated.

Returns whether the underlying mapping is readonly, meaning that attempts to write will fault.

Makes the specified range within this Mmap to be read/write.

Makes the specified range within this Mmap to be read/execute.

Returns the underlying file that this mmap is mapping, if present.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.