#[repr(u8)]pub enum SizeClass {
Bytes8 = 0,
Bytes16 = 1,
Bytes32 = 2,
Bytes64 = 3,
Bytes128 = 4,
Bytes256 = 5,
Bytes512 = 6,
Bytes1024 = 7,
Bytes2048 = 8,
}Expand description
Fixed set of object sizes served by the slab allocator.
Variants§
Bytes8 = 0
Bytes16 = 1
Bytes32 = 2
Bytes64 = 3
Bytes128 = 4
Bytes256 = 5
Bytes512 = 6
Bytes1024 = 7
Bytes2048 = 8
Implementations§
Source§impl SizeClass
impl SizeClass
Sourcepub fn from_layout(layout: Layout) -> Option<SizeClass>
pub fn from_layout(layout: Layout) -> Option<SizeClass>
Select the smallest size class that can satisfy layout.
Returns None if the requested size or alignment exceeds the slab’s capability.
Sourcepub const fn slab_pages(self, page_size: usize) -> usize
pub const fn slab_pages(self, page_size: usize) -> usize
How many pages are needed for a single slab of this class.
Smaller classes use 1 page, larger classes may use more to amortise the per-page header overhead.
Trait Implementations§
impl Copy for SizeClass
impl Eq for SizeClass
impl StructuralPartialEq for SizeClass
Auto Trait Implementations§
impl Freeze for SizeClass
impl RefUnwindSafe for SizeClass
impl Send for SizeClass
impl Sync for SizeClass
impl Unpin for SizeClass
impl UnsafeUnpin for SizeClass
impl UnwindSafe for SizeClass
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