pub struct StackAllocator<const SIZE: usize> { /* private fields */ }Expand description
Stack-based allocator for temporary allocations
Allocations must be freed in LIFO order. Very fast and suitable for nested scopes.
Implementations§
Source§impl<const SIZE: usize> StackAllocator<SIZE>
impl<const SIZE: usize> StackAllocator<SIZE>
Source§impl<const SIZE: usize> StackAllocator<SIZE>
impl<const SIZE: usize> StackAllocator<SIZE>
Sourcepub fn scoped_alloc(
&self,
layout: Layout,
) -> Option<(NonNull<u8>, StackGuard<'_, SIZE>)>
pub fn scoped_alloc( &self, layout: Layout, ) -> Option<(NonNull<u8>, StackGuard<'_, SIZE>)>
Allocate with RAII guard that automatically frees on drop
Trait Implementations§
Source§impl<const SIZE: usize> Default for StackAllocator<SIZE>
impl<const SIZE: usize> Default for StackAllocator<SIZE>
impl<const SIZE: usize> Send for StackAllocator<SIZE>
impl<const SIZE: usize> Sync for StackAllocator<SIZE>
Auto Trait Implementations§
impl<const SIZE: usize> !Freeze for StackAllocator<SIZE>
impl<const SIZE: usize> !RefUnwindSafe for StackAllocator<SIZE>
impl<const SIZE: usize> Unpin for StackAllocator<SIZE>
impl<const SIZE: usize> UnwindSafe for StackAllocator<SIZE>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more