Struct region::Allocation
source · [−]pub struct Allocation { /* private fields */ }
Expand description
A handle to an owned region of memory.
This handle does not dereference to a slice, since the underlying memory may
have been created with Protection::NONE
.
Implementations
sourceimpl Allocation
impl Allocation
sourcepub fn as_ptr<T>(&self) -> *const T
pub fn as_ptr<T>(&self) -> *const T
Returns a pointer to the allocation’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 allocation’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 allocation’s address space.
The returned range is half-open, which means that the end pointer points one past the last element of the allocation. This way, an empty allocation is represented by two equal pointers, and the difference between the two pointers represents the size of the allocation.
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 allocation’s address space.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Allocation
impl !Send for Allocation
impl !Sync for Allocation
impl Unpin for Allocation
impl UnwindSafe for Allocation
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