pub struct MemoryMappingBuilder<'a> {
    pub(crate) descriptor: Option<&'a dyn AsRawDescriptor>,
    pub(crate) is_file_descriptor: bool,
    pub(crate) size: usize,
    pub(crate) offset: Option<u64>,
    pub(crate) align: Option<u64>,
    pub(crate) protection: Option<Protection>,
    pub(crate) populate: bool,
}

Fields§

§descriptor: Option<&'a dyn AsRawDescriptor>§is_file_descriptor: bool§size: usize§offset: Option<u64>§align: Option<u64>§protection: Option<Protection>§populate: bool

Implementations§

source§

impl<'a> MemoryMappingBuilder<'a>

Builds a MemoryMapping object from the specified arguments.

source

pub fn new(size: usize) -> MemoryMappingBuilder<'a>

Creates a new builder specifying size of the memory region in bytes.

source

pub fn from_file(self, file: &'a File) -> MemoryMappingBuilder<'_>

Build the memory mapping given the specified File to mapped memory

Default: Create a new memory mapping.

Note: this is a forward looking interface to accomodate platforms that require special handling for file backed mappings.

source

pub fn from_shared_memory( self, shm: &'a SharedMemory ) -> MemoryMappingBuilder<'_>

Build the memory mapping given the specified SharedMemory to mapped memory

Default: Create a new memory mapping.

source

pub fn offset(self, offset: u64) -> MemoryMappingBuilder<'a>

Offset in bytes from the beginning of the mapping to start the mmap.

Default: No offset

source

pub fn protection(self, protection: Protection) -> MemoryMappingBuilder<'a>

Protection (e.g. readable/writable) of the memory region.

Default: Read/write

source

pub fn align(self, alignment: u64) -> MemoryMappingBuilder<'a>

Alignment of the memory region mapping in bytes.

Default: No alignment

source§

impl<'a> MemoryMappingBuilder<'a>

source

pub fn populate(self) -> MemoryMappingBuilder<'a>

Request that the mapped pages are pre-populated

Default: Do not populate

source

pub fn build(self) -> Result<CrateMemoryMapping>

Build a MemoryMapping from the provided options.

source

pub(crate) fn wrap( mapping: MemoryMapping, file_descriptor: Option<&'a dyn AsRawDescriptor> ) -> Result<CrateMemoryMapping>

Trait Implementations§

source§

impl<'a> MemoryMappingBuilderUnix<'a> for MemoryMappingBuilder<'a>

source§

fn from_descriptor( self, descriptor: &'a dyn AsRawDescriptor ) -> MemoryMappingBuilder<'_>

Build the memory mapping given the specified descriptor to mapped memory

Default: Create a new memory mapping.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.