pub struct SlabCache {
pub size_class: SizeClass,
/* private fields */
}Expand description
Cache for a single SizeClass.
Fields§
§size_class: SizeClassImplementations§
Source§impl SlabCache
impl SlabCache
pub const fn new(size_class: SizeClass) -> Self
Sourcepub fn alloc_object<const PAGE_SIZE: usize>(&mut self) -> Option<usize>
pub fn alloc_object<const PAGE_SIZE: usize>(&mut self) -> Option<usize>
Try to allocate one object. Returns Some(obj_addr) or None if no slabs available.
Sourcepub fn dealloc_object<const PAGE_SIZE: usize>(
&mut self,
obj_addr: usize,
) -> CacheDeallocResult
pub fn dealloc_object<const PAGE_SIZE: usize>( &mut self, obj_addr: usize, ) -> CacheDeallocResult
Free an object back to this cache (local CPU path — under lock).
Returns whether the slab should be returned to the page allocator.
Auto Trait Implementations§
impl Freeze for SlabCache
impl RefUnwindSafe for SlabCache
impl Send for SlabCache
impl Sync for SlabCache
impl Unpin for SlabCache
impl UnsafeUnpin 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