Struct dense_heap::dheap::DBox
source · pub struct DBox<'a, T> { /* private fields */ }Expand description
DBox is a smart pointer designed to work with the DHeap allocator.
It provides similar functionality to Box in the Rust standard library but is specifically tailored for use with the dense heap implementation (DHeap). The DBox manages the memory of its inner value T by maintaining a mutable reference to the DHeapNode in the DHeap that stores the value. When the DBox goes out of scope, it deallocates the memory held in the DHeap.
Implementations§
source§impl<'a, T> DBox<'a, T>
impl<'a, T> DBox<'a, T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the DBox and retrieves the inner value T.
This function replaces the DBox’s memory cell with a Moved state, indicating
that the memory has been moved out of the DHeap before the DBox is dropped.
After replacing the cell, it returns the inner value of the DBox.
Returns
- The inner value
Tcontained within theDBox.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for DBox<'a, T>
impl<'a, T> !Send for DBox<'a, T>
impl<'a, T> !Sync for DBox<'a, T>
impl<'a, T> Unpin for DBox<'a, T>where T: Unpin,
impl<'a, T> !UnwindSafe for DBox<'a, T>
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