pub struct MemoryPoolAllocator<const N: usize, const M: usize> { /* private fields */ }Expand description
Array chunk tracking-based fixed-size memory pool allocator
§Type Parameters
N- Total pool size in bytesM- Number of chunks to divide the pool into
Implementations§
Source§impl<const N: usize, const M: usize> MemoryPoolAllocator<N, M>
impl<const N: usize, const M: usize> MemoryPoolAllocator<N, M>
Sourcepub const CHUNK_SIZE: usize
pub const CHUNK_SIZE: usize
Size of each chunk in bytes
Sourcepub const unsafe fn new(pool: *mut u8) -> Self
pub const unsafe fn new(pool: *mut u8) -> Self
§Safety
The caller must ensure the pointer is valid for reads/writes of N bytes and properly aligned for all pool operations.
Sourcepub fn try_allocate(&self, layout: Layout) -> Result<*mut u8>
pub fn try_allocate(&self, layout: Layout) -> Result<*mut u8>
Attempts to allocate memory with the specified layout
Trait Implementations§
Source§impl<const N: usize, const M: usize> Drop for MemoryPoolAllocator<N, M>
Available on crate feature zero-on-drop only.
impl<const N: usize, const M: usize> Drop for MemoryPoolAllocator<N, M>
Available on crate feature
zero-on-drop only.impl<const N: usize, const M: usize> Send for MemoryPoolAllocator<N, M>
impl<const N: usize, const M: usize> Sync for MemoryPoolAllocator<N, M>
Auto Trait Implementations§
impl<const N: usize, const M: usize> !Freeze for MemoryPoolAllocator<N, M>
impl<const N: usize, const M: usize> !RefUnwindSafe for MemoryPoolAllocator<N, M>
impl<const N: usize, const M: usize> Unpin for MemoryPoolAllocator<N, M>
impl<const N: usize, const M: usize> UnwindSafe for MemoryPoolAllocator<N, M>
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