pub struct LayoutCacheMap {
pub entries: Vec<NodeCache>,
}Expand description
External layout cache, parallel to LayoutTree.nodes.
cache_map.entries[i] holds the cache for LayoutTree.nodes[i].
Stored on LayoutCache (persists across frames).
This is Azul’s improvement over Taffy’s on-node cache:
LayoutNodestays slim (0 bytes overhead)- No
&mut treeneeded to read/write cache entries - Cache can be resized independently after reconciliation
- O(1) indexed lookup (Vec) instead of O(log n) (BTreeMap)
Fields§
§entries: Vec<NodeCache>Implementations§
Source§impl LayoutCacheMap
impl LayoutCacheMap
Sourcepub fn resize_to_tree(&mut self, tree_len: usize)
pub fn resize_to_tree(&mut self, tree_len: usize)
Resize to match tree length after reconciliation. New nodes get empty (dirty) caches. Removed nodes’ caches are dropped.
Sourcepub fn get_mut(&mut self, node_index: usize) -> &mut NodeCache
pub fn get_mut(&mut self, node_index: usize) -> &mut NodeCache
O(1) mutable lookup by layout tree index.
Sourcepub fn mark_dirty(&mut self, node_index: usize, tree: &[LayoutNode])
pub fn mark_dirty(&mut self, node_index: usize, tree: &[LayoutNode])
Invalidate a node and propagate dirty flags upward through ancestors.
Implements Taffy’s early-stop optimization: propagation halts at the first ancestor whose cache is already empty (i.e., already dirty). This prevents redundant O(depth) propagation when multiple children of the same parent are dirtied.
Trait Implementations§
Source§impl Clone for LayoutCacheMap
impl Clone for LayoutCacheMap
Source§fn clone(&self) -> LayoutCacheMap
fn clone(&self) -> LayoutCacheMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LayoutCacheMap
impl Debug for LayoutCacheMap
Source§impl Default for LayoutCacheMap
impl Default for LayoutCacheMap
Source§fn default() -> LayoutCacheMap
fn default() -> LayoutCacheMap
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LayoutCacheMap
impl RefUnwindSafe for LayoutCacheMap
impl Send for LayoutCacheMap
impl Sync for LayoutCacheMap
impl Unpin for LayoutCacheMap
impl UnsafeUnpin for LayoutCacheMap
impl UnwindSafe for LayoutCacheMap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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