Struct vm_memory::mmap::MmapRegionBuilder
source · [−]pub struct MmapRegionBuilder<B = ()> { /* private fields */ }Expand description
A factory struct to build MmapRegion objects.
Implementations
sourceimpl<B: Bitmap + Default> MmapRegionBuilder<B>
impl<B: Bitmap + Default> MmapRegionBuilder<B>
sourceimpl<B: Bitmap> MmapRegionBuilder<B>
impl<B: Bitmap> MmapRegionBuilder<B>
sourcepub fn new_with_bitmap(size: usize, bitmap: B) -> Self
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 ().
sourcepub fn with_mmap_prot(self, prot: i32) -> Self
pub fn with_mmap_prot(self, prot: i32) -> Self
Create the MmapRegion object with the specified mmap memory protection flag prot.
sourcepub fn with_mmap_flags(self, flags: i32) -> Self
pub fn with_mmap_flags(self, flags: i32) -> Self
Create the MmapRegion object with the specified mmap flags.
sourcepub fn with_file_offset(self, file_offset: FileOffset) -> Self
pub fn with_file_offset(self, file_offset: FileOffset) -> Self
Create the MmapRegion object with the specified file_offset.
sourcepub fn with_hugetlbfs(self, hugetlbfs: bool) -> Self
pub fn with_hugetlbfs(self, hugetlbfs: bool) -> Self
Create the MmapRegion object with the specified hugetlbfs flag.
sourcepub unsafe fn with_raw_mmap_pointer(self, raw_ptr: *mut u8) -> Self
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.
sourcepub fn build(self) -> Result<MmapRegion<B>, Error>
pub fn build(self) -> Result<MmapRegion<B>, Error>
Build the MmapRegion object.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more