pub struct AllocatedBlock<'a> { /* private fields */ }
Expand description
A block of memory allocated by an Allocator
.
Implementations§
Source§impl AllocatedBlock<'_>
impl AllocatedBlock<'_>
Sourcepub fn as_ptr(&self) -> *const c_void
pub fn as_ptr(&self) -> *const c_void
Returns a pointer to the allocated memory.
Note that, depending on the exact allocator used, this may not a pointer to memory accessible by the CPU.
Sourcepub fn as_mut_ptr(&mut self) -> *mut c_void
pub fn as_mut_ptr(&mut self) -> *mut c_void
Returns a mutable pointer to the allocated memory.
Note that, depending on the exact allocator used, this may not a pointer to memory accessible by the CPU.
Sourcepub fn allocator(&self) -> &Allocator
pub fn allocator(&self) -> &Allocator
Returns the Allocator
that allocated this block of memory.
Sourcepub fn into_raw(self) -> *mut c_void
pub fn into_raw(self) -> *mut c_void
Consumes the AllocatedBlock
, returning the pointer to its data.
The pointer must be freed with Allocator::free
, using the allocator that initially created it. Not doing so
will cause a memory leak.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for AllocatedBlock<'a>
impl<'a> !RefUnwindSafe for AllocatedBlock<'a>
impl<'a> !Send for AllocatedBlock<'a>
impl<'a> !Sync for AllocatedBlock<'a>
impl<'a> Unpin for AllocatedBlock<'a>
impl<'a> !UnwindSafe for AllocatedBlock<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more