pub struct Slab { /* private fields */ }Expand description
Individual slab (page) containing multiple objects
Implementations§
Source§impl Slab
impl Slab
pub fn new(base_ptr: NonNull<u8>, slab_size: usize, object_size: usize) -> Self
Sourcepub fn deallocate(&mut self, ptr: NonNull<u8>) -> Result<(), SlabError>
pub fn deallocate(&mut self, ptr: NonNull<u8>) -> Result<(), SlabError>
Deallocate an object in this slab
Sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Check if slab is partially filled
Sourcepub fn get_utilization(&self) -> f64
pub fn get_utilization(&self) -> f64
Get utilization ratio (0.0 to 1.0)
Auto Trait Implementations§
impl Freeze for Slab
impl RefUnwindSafe for Slab
impl !Send for Slab
impl !Sync for Slab
impl Unpin for Slab
impl UnsafeUnpin for Slab
impl UnwindSafe for Slab
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more