pub struct MemStack { /* private fields */ }Expand description
A memory stack for temporary allocations.
This provides fast, stack-based allocation for scratch space needed by algorithms. Allocations are invalidated when the stack is reset.
Implementations§
Source§impl MemStack
impl MemStack
Sourcepub fn alloc<T>(&mut self, count: usize) -> &mut [MaybeUninit<T>]
pub fn alloc<T>(&mut self, count: usize) -> &mut [MaybeUninit<T>]
Sourcepub fn alloc_zeroed<T: Zeroable>(&mut self, count: usize) -> &mut [T]
pub fn alloc_zeroed<T: Zeroable>(&mut self, count: usize) -> &mut [T]
Allocates and zeros a slice of the given type.
Sourcepub fn make_sub_stack(&mut self) -> MemStack
pub fn make_sub_stack(&mut self) -> MemStack
Creates a sub-stack with the remaining memory.
This is useful for recursive algorithms that need to pass scratch space to sub-operations.
Note: This is a placeholder implementation. A full implementation would use raw pointers to share the buffer without ownership transfer.
Auto Trait Implementations§
impl Freeze for MemStack
impl RefUnwindSafe for MemStack
impl Send for MemStack
impl Sync for MemStack
impl Unpin for MemStack
impl UnwindSafe for MemStack
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