pub struct MmapRegionBuilder<B = ()> { /* private fields */ }Expand description
A factory struct to build MmapRegion objects.
Implementations§
Source§impl<B: Bitmap + Default> MmapRegionBuilder<B>
impl<B: Bitmap + Default> MmapRegionBuilder<B>
Source§impl<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.