pub struct SlabCache { /* private fields */ }Expand description
Slab cache for a specific size class
Implementations§
Source§impl SlabCache
impl SlabCache
pub const fn new(size_class: SizeClass) -> Self
Sourcepub fn alloc_object(
&mut self,
page_allocator: &mut dyn BytePageAllocator,
page_size: usize,
) -> AllocResult<(usize, usize)>
pub fn alloc_object( &mut self, page_allocator: &mut dyn BytePageAllocator, page_size: usize, ) -> AllocResult<(usize, usize)>
Allocate an object from this cache Returns (object_addr, bytes_allocated_from_page_allocator)
Sourcepub fn dealloc_object(
&mut self,
obj_addr: usize,
page_allocator: &mut dyn BytePageAllocator,
page_size: usize,
) -> (usize, bool)
pub fn dealloc_object( &mut self, obj_addr: usize, page_allocator: &mut dyn BytePageAllocator, page_size: usize, ) -> (usize, bool)
Deallocate an object Returns (bytes_freed_from_page_allocator, actually_deallocated) actually_deallocated is false if this was a double-free
Auto Trait Implementations§
impl Freeze for SlabCache
impl RefUnwindSafe for SlabCache
impl Send for SlabCache
impl Sync for SlabCache
impl Unpin for SlabCache
impl UnwindSafe for SlabCache
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