pub struct SizeClassCache {
pub bump: usize,
pub capacity: usize,
pub generation: u32,
pub hits: usize,
pub misses: usize,
}Expand description
Per-size-class cache for frequently-used allocation sizes.
Fields§
§bump: usizeBump pointer into the cache buffer.
capacity: usizeTotal capacity of this cache.
generation: u32Current generation counter (incremented on eviction).
hits: usizeNumber of hits for cache statistics.
misses: usizeNumber of misses for cache statistics.
Implementations§
Source§impl SizeClassCache
impl SizeClassCache
Sourcepub const fn new(capacity: usize) -> SizeClassCache
pub const fn new(capacity: usize) -> SizeClassCache
Creates a new cache with the given capacity.
Sourcepub fn allocate(&mut self) -> Option<usize>
pub fn allocate(&mut self) -> Option<usize>
Attempts to allocate a block from the cache. Returns the index if successful, None if cache is full.
Trait Implementations§
Source§impl Clone for SizeClassCache
impl Clone for SizeClassCache
Source§fn clone(&self) -> SizeClassCache
fn clone(&self) -> SizeClassCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SizeClassCache
Auto Trait Implementations§
impl Freeze for SizeClassCache
impl RefUnwindSafe for SizeClassCache
impl Send for SizeClassCache
impl Sync for SizeClassCache
impl Unpin for SizeClassCache
impl UnsafeUnpin for SizeClassCache
impl UnwindSafe for SizeClassCache
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