Struct vm_memory::mmap::MmapRegionBuilder

source ·
pub struct MmapRegionBuilder<B = ()> { /* private fields */ }
Expand description

A factory struct to build MmapRegion objects.

Implementations§

source§

impl<B: Bitmap + Default> MmapRegionBuilder<B>

source

pub fn new(size: usize) -> Self

Create a new MmapRegionBuilder using the default value for the inner Bitmap object.

source§

impl<B: Bitmap> MmapRegionBuilder<B>

source

pub fn new_with_bitmap(size: usize, bitmap: B) -> Self

Create a new MmapRegionBuilder using the provided Bitmap object.

When instantiating the builder for a region that does not require dirty bitmap bitmap tracking functionality, we can specify a trivial Bitmap implementation such as ().

source

pub fn with_mmap_prot(self, prot: i32) -> Self

Create the MmapRegion object with the specified mmap memory protection flag prot.

source

pub fn with_mmap_flags(self, flags: i32) -> Self

Create the MmapRegion object with the specified mmap flags.

source

pub fn with_file_offset(self, file_offset: FileOffset) -> Self

Create the MmapRegion object with the specified file_offset.

source

pub fn with_hugetlbfs(self, hugetlbfs: bool) -> Self

Create the MmapRegion object with the specified hugetlbfs flag.

source

pub unsafe fn with_raw_mmap_pointer(self, raw_ptr: *mut u8) -> Self

Create the MmapRegion object with pre-mmapped raw pointer.

§Safety

To use this safely, the caller must guarantee that raw_addr and self.size define a region within a valid mapping that is already present in the process.

source

pub fn build(self) -> Result<MmapRegion<B>, Error>

Build the MmapRegion object.

Auto Trait Implementations§

§

impl<B> Freeze for MmapRegionBuilder<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for MmapRegionBuilder<B>
where B: RefUnwindSafe,

§

impl<B = ()> !Send for MmapRegionBuilder<B>

§

impl<B = ()> !Sync for MmapRegionBuilder<B>

§

impl<B> Unpin for MmapRegionBuilder<B>
where B: Unpin,

§

impl<B> UnwindSafe for MmapRegionBuilder<B>
where B: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.