pub struct Region { /* private fields */ }
Expand description
A descriptor for a mapped memory region.
The region encompasses zero or more pages (e.g. OpenBSD can have null-sized virtual pages).
Implementations
sourceimpl Region
impl Region
sourcepub fn as_ptr<T>(&self) -> *const T
pub fn as_ptr<T>(&self) -> *const T
Returns a pointer to the region’s base address.
The address is always aligned to the operating system’s page size.
sourcepub fn as_mut_ptr<T>(&mut self) -> *mut T
pub fn as_mut_ptr<T>(&mut self) -> *mut T
Returns a mutable pointer to the region’s base address.
sourcepub fn as_ptr_range<T>(&self) -> Range<*const T>
pub fn as_ptr_range<T>(&self) -> Range<*const T>
Returns two raw pointers spanning the region’s address space.
The returned range is half-open, which means that the end pointer points one past the last element of the region. This way, an empty region is represented by two equal pointers, and the difference between the two pointers represents the size of the region.
sourcepub fn as_mut_ptr_range<T>(&mut self) -> Range<*mut T>
pub fn as_mut_ptr_range<T>(&mut self) -> Range<*mut T>
Returns two mutable raw pointers spanning the region’s address space.
sourcepub fn is_committed(&self) -> bool
pub fn is_committed(&self) -> bool
Returns whether the region is committed or not.
This is always true for all operating system’s, the exception being
MEM_RESERVE
pages on Windows.
sourcepub fn is_readable(&self) -> bool
pub fn is_readable(&self) -> bool
Returns whether the region is readable or not.
sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Returns whether the region is writable or not.
sourcepub fn is_executable(&self) -> bool
pub fn is_executable(&self) -> bool
Returns whether the region is executable or not.
sourcepub fn is_guarded(&self) -> bool
pub fn is_guarded(&self) -> bool
Returns whether the region is guarded or not.
Returns whether the region is shared between processes or not.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the size of the region in bytes.
The size is always aligned to a multiple of the operating system’s page size.
sourcepub fn protection(&self) -> Protection
pub fn protection(&self) -> Protection
Returns the protection attributes of the region.
Trait Implementations
impl Copy for Region
impl Eq for Region
impl Send for Region
impl StructuralEq for Region
impl StructuralPartialEq for Region
impl Sync for Region
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more