pub struct SlabByteAllocator<const PAGE_SIZE: usize = { crate::DEFAULT_PAGE_SIZE }> { /* private fields */ }Expand description
Slab byte allocator with pooled linked lists
Implementations§
Source§impl<const PAGE_SIZE: usize> SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> SlabByteAllocator<PAGE_SIZE>
pub const fn new() -> Self
pub fn set_page_allocator( &mut self, page_allocator: *mut dyn PageAllocatorForSlab, )
Trait Implementations§
Source§impl<const PAGE_SIZE: usize> ByteAllocator for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> ByteAllocator for SlabByteAllocator<PAGE_SIZE>
Source§fn alloc(&mut self, layout: Layout) -> AllocResult<NonNull<u8>>
fn alloc(&mut self, layout: Layout) -> AllocResult<NonNull<u8>>
Allocate memory with the given size (in bytes) and alignment. Read more
Source§fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout)
fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout)
Deallocate memory at the given position, size, and alignment. Read more
Source§fn total_bytes(&self) -> usize
fn total_bytes(&self) -> usize
Returns total memory size in bytes managed by this allocator.
Source§fn used_bytes(&self) -> usize
fn used_bytes(&self) -> usize
Returns allocated memory size in bytes.
Source§fn available_bytes(&self) -> usize
fn available_bytes(&self) -> usize
Returns available memory size in bytes.
Source§impl<const PAGE_SIZE: usize> Default for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Default for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Send for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Sync for SlabByteAllocator<PAGE_SIZE>
Auto Trait Implementations§
impl<const PAGE_SIZE: usize> Freeze for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize = { crate::DEFAULT_PAGE_SIZE }> !RefUnwindSafe for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Unpin for SlabByteAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize = { crate::DEFAULT_PAGE_SIZE }> !UnwindSafe for SlabByteAllocator<PAGE_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