pub struct StackAllocator {
pub allocate: StackAllocateFn,
pub deallocate: StackDeallocateFn,
}Expand description
Allocator hooks used to obtain and release coroutine Stack backing memory.
By default, Stack uses StackAllocator::GLOBAL, which forwards to
alloc::alloc::alloc and alloc::alloc::dealloc. Platforms whose global heap
places large allocations in memory that cannot safely back stacks (such as PSRAM on
Espressif boards, which becomes inaccessible during flash writes) can install an
allocator backed by always-accessible internal SRAM via set_stack_allocator.
Fields§
§allocate: StackAllocateFnAllocate backing memory for a stack with the requested Layout.
deallocate: StackDeallocateFnRelease backing memory previously returned by Self::allocate with the same Layout.
Implementations§
Source§impl StackAllocator
impl StackAllocator
Sourcepub const GLOBAL: Self
pub const GLOBAL: Self
The default stack allocator backed by alloc::alloc::alloc and alloc::alloc::dealloc.
Sourcepub const fn new(
allocate: StackAllocateFn,
deallocate: StackDeallocateFn,
) -> Self
pub const fn new( allocate: StackAllocateFn, deallocate: StackDeallocateFn, ) -> Self
Create a stack allocator from an allocate/deallocate function-pointer pair.
Trait Implementations§
Source§impl Clone for StackAllocator
impl Clone for StackAllocator
Source§fn clone(&self) -> StackAllocator
fn clone(&self) -> StackAllocator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more