pub struct TopLayerIndex { /* private fields */ }Expand description
Dense per-node TopLayerState plus the hoisted overlay roots in document (= back-to-front
paint) order, relative to one layout root (NodeId::ROOT unless an engine lays out a subtree).
Implementations§
Source§impl TopLayerIndex
impl TopLayerIndex
Sourcepub const fn new() -> Self
pub const fn new() -> Self
An empty index rooted at NodeId::ROOT that rebuilds on its first sync / refresh.
Sourcepub fn states(&self) -> &[TopLayerState]
pub fn states(&self) -> &[TopLayerState]
Per-node state column indexed by NodeId::index(). After every Self::sync /
Self::refresh it covers every store slot (len() >= store.capacity()); the runtime
publishes it zero-copy as the top_layer_states scene fact. A slot reused by a newer node
is corrected at the next commit.
Sourcepub fn state(&self, id: NodeId) -> TopLayerState
pub fn state(&self, id: NodeId) -> TopLayerState
Generation-safe state of id (None for a stale id whose slot was reused).
Sourcepub fn is_hoisted(&self, id: NodeId) -> bool
pub fn is_hoisted(&self, id: NodeId) -> bool
Whether id is an effectively-open overlay root hoisted into the top layer.
Sourcepub fn hoisted(&self) -> &[NodeId]
pub fn hoisted(&self) -> &[NodeId]
Hoisted overlay roots in document order (back-to-front paint order).
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Bumped only when Self::hoisted changes (membership or order).
Sourcepub fn recompute_count(&self) -> u64
pub fn recompute_count(&self) -> u64
Number of recomputes so far (regression guard against per-frame rescans).
Sourcepub fn transitions(&self) -> &[NodeId]
pub fn transitions(&self) -> &[NodeId]
Full ids whose state changed in the most recent recompute.
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Forces a full recompute on the next Self::sync / Self::sync_nodes /
Self::refresh (engine reset, media or committed container environment changed).
Sourcepub fn refresh(
&mut self,
store: &NodeStore,
root: NodeId,
env: &DisplayEnv<'_>,
) -> bool
pub fn refresh( &mut self, store: &NodeStore, root: NodeId, env: &DisplayEnv<'_>, ) -> bool
Rebuilds when the root changed or a rebuild is pending. Returns true when
Self::hoisted changed.
Sourcepub fn sync(
&mut self,
store: &NodeStore,
changes: &ChangeSet,
env: &DisplayEnv<'_>,
) -> bool
pub fn sync( &mut self, store: &NodeStore, changes: &ChangeSet, env: &DisplayEnv<'_>, ) -> bool
Applies one committed ChangeSet, recomputing only when it can change a state. Returns
true when Self::hoisted changed.
Sourcepub fn sync_nodes(
&mut self,
store: &NodeStore,
nodes: &[NodeId],
env: &DisplayEnv<'_>,
) -> bool
pub fn sync_nodes( &mut self, store: &NodeStore, nodes: &[NodeId], env: &DisplayEnv<'_>, ) -> bool
Applies a pseudo-state change of nodes (StateRules may patch their display).
Returns true when Self::hoisted changed.