pub struct AllocPool<const SIZE: usize = 1514, const ALIGN: usize = 1>where
Align<ALIGN>: ValidAlign,{ /* private fields */ }Expand description
A Pool that allocates each buffer from the heap.
At most max_count buffers are allocated at a time. If the heap runs out
before that, the allocation aborts, like any other heap allocation. Make sure
the heap has room for max_count buffers.
StaticPool explains how to pick SIZE.
ALIGN can be 1, 2, 4, 8, 16, 32 or 64.
The build fails for the same buffer sizes that fail with StaticPool.
It must be 'static. It can go in a static:
use xarxa::{AllocPool, Stack};
static POOL: AllocPool<1514> = AllocPool::new(64);
let stack = Stack::new(&POOL, 0x1234_5678);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<const SIZE: usize = 1514, const ALIGN: usize = 1> !Freeze for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> RefUnwindSafe for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> Send for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> Sync for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> Unpin for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> UnsafeUnpin for AllocPool<SIZE, ALIGN>
impl<const SIZE: usize, const ALIGN: usize> UnwindSafe for AllocPool<SIZE, ALIGN>
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