pub struct Cache {
final_layout_entry: Option<CacheEntry<LayoutOutput>>,
measure_entries: [Option<CacheEntry<Size<f32>>>; 9],
recently_used_entries: u16,
next_measure_entry: u8,
is_empty: bool,
}Expand description
A cache for caching the results of a sizing a Grid Item or Flexbox Item
Fields§
§final_layout_entry: Option<CacheEntry<LayoutOutput>>The cache entry for the node’s final layout
measure_entries: [Option<CacheEntry<Size<f32>>>; 9]The cache entries for the node’s preliminary size measurements
recently_used_entries: u16Tracks which measure entries have been used since the eviction cursor last passed them
next_measure_entry: u8The next measure entry to consider replacing
is_empty: boolTracks if all cache entries are empty
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn get(&mut self, input: &LayoutInput) -> Option<LayoutOutput>
pub fn get(&mut self, input: &LayoutInput) -> Option<LayoutOutput>
Try to retrieve a cached result from the cache
Sourcepub fn store(&mut self, input: &LayoutInput, layout_output: LayoutOutput)
pub fn store(&mut self, input: &LayoutInput, layout_output: LayoutOutput)
Store a computed size in the cache
Sourcepub fn clear(&mut self) -> ClearState
pub fn clear(&mut self) -> ClearState
Clear all cache entries and reports clear operation outcome (ClearState)
Trait Implementations§
impl StructuralPartialEq for Cache
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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