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,
mode: CacheMode,
}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
mode: CacheModeThe sizing_mode and vertical_margins_are_collapsible inputs that all of the cache’s
entries were computed with. Results are only retrieved for inputs that have the same mode,
and storing a result that was computed with a different mode drops the existing entries.
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)