Struct webrender::lru_cache::LRUTracker
source · struct LRUTracker<H> {
head: Option<ItemIndex>,
tail: Option<ItemIndex>,
free_list_head: Option<ItemIndex>,
items: Vec<Item<H>>,
}
Expand description
Internal implementation of the LRU tracking list
Fields§
§head: Option<ItemIndex>
Current head of the list - this is the oldest item that will be evicted next.
tail: Option<ItemIndex>
Current tail of the list - this is the most recently used element.
free_list_head: Option<ItemIndex>
As tracking items are removed, they are stored in a freelist, to minimize heap allocations
items: Vec<Item<H>>
The freelist that stores all the LRU tracking items
Implementations§
source§impl<H> LRUTracker<H>where
H: Debug,
impl<H> LRUTracker<H>where
H: Debug,
sourcefn link_as_new_tail(&mut self, item_index: ItemIndex)
fn link_as_new_tail(&mut self, item_index: ItemIndex)
Internal function that takes an item index, and links it to the end of the tracker list (makes it the newest item).
sourcefn unlink(&mut self, item_index: ItemIndex)
fn unlink(&mut self, item_index: ItemIndex)
Internal function that takes an LRU item index, and removes it from the current doubly linked list. Used during removal of items, and also when items are moved to the back of the list as they’re touched.
sourcefn push_new(&mut self, handle: H) -> ItemIndex
fn push_new(&mut self, handle: H) -> ItemIndex
Push a new LRU tracking item on to the back of the list, marking it as the most recent item.
sourcefn peek_front(&self) -> Option<&H>
fn peek_front(&self) -> Option<&H>
Returns a reference to the oldest element, or None if the list is empty.
sourcefn pop_front(&mut self) -> Option<H>
fn pop_front(&mut self) -> Option<H>
Remove the oldest element from the front of the LRU list. Returns None if the list is empty.
Trait Implementations§
source§impl<H> MallocSizeOf for LRUTracker<H>where
H: MallocSizeOf,
impl<H> MallocSizeOf for LRUTracker<H>where
H: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl<H> Freeze for LRUTracker<H>
impl<H> RefUnwindSafe for LRUTracker<H>where
H: RefUnwindSafe,
impl<H> Send for LRUTracker<H>where
H: Send,
impl<H> Sync for LRUTracker<H>where
H: Sync,
impl<H> Unpin for LRUTracker<H>where
H: Unpin,
impl<H> UnwindSafe for LRUTracker<H>where
H: UnwindSafe,
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
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>
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>
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