pub struct NodeDataFingerprint {
pub content_hash: u64,
pub state_hash: u64,
pub inline_css_hash: u64,
pub ids_classes_hash: u64,
pub callbacks_hash: u64,
pub attrs_hash: u64,
pub dataset_hash: u64,
}Expand description
Per-node hash broken into independent fields for fast change detection.
Instead of a single u64 hash (which loses all granularity), this stores
separate hashes per field category. Comparing two fingerprints is O(1)
(6 integer comparisons) and immediately tells us WHICH category changed,
avoiding the more expensive compute_node_changes() for unchanged nodes.
Two-tier strategy:
- Tier 1 (this struct): O(1) per node, identifies which categories changed.
- Tier 2 (
compute_node_changes): O(n) per changed field, does field-by-field comparison only for nodes that Tier 1 identified as changed.
Fields§
§content_hash: u64Hash of node_type (Text content, Image ref, Div, etc.)
state_hash: u64Hash of styled_node_state (hover, focus, active bits)
inline_css_hash: u64Hash of inline CSS properties
ids_classes_hash: u64Hash of ids_and_classes
callbacks_hash: u64Hash of callbacks (event types + function pointers)
attrs_hash: u64Hash of the layout-relevant attributes (contenteditable, flags)
dataset_hash: u64Hash of the dataset’s PRESENCE and TYPE — never its allocation.
A widget’s dataset is state, not layout. Most widgets allocate a fresh
RefAny on every build, and RefAny hashes by pointer, so hashing the
dataset into attrs_hash (which maps to CONTENTEDITABLE, a layout
change) made every with_dataset node LAYOUT-DIRTY on every
RefreshDom: the TextArea became a standalone layout root on each
callback, was re-laid-out with its min-height while its flex
container kept the old slot, and painted 64 px into a 36 px slot — over
the slider beneath it. A dataset change is NodeChangeSet::DATASET,
which affects neither layout nor paint.
Implementations§
Source§impl NodeDataFingerprint
impl NodeDataFingerprint
Sourcepub fn compute(node: &NodeData, styled_state: Option<&StyledNodeState>) -> Self
pub fn compute(node: &NodeData, styled_state: Option<&StyledNodeState>) -> Self
Compute a fingerprint from a node’s data and styled state.
Sourcepub const fn diff(&self, other: &Self) -> NodeChangeSet
pub const fn diff(&self, other: &Self) -> NodeChangeSet
Returns a quick NodeChangeSet by comparing two fingerprints.
This is O(1) — just comparing 7 u64s.
The result is conservative: if a field hash differs, we set the
broadest applicable flag. For precise classification (e.g., which
CSS properties changed and their relayout_scope()), the caller
should fall back to compute_node_changes() for changed nodes.
Sourcepub fn is_identical(&self, other: &Self) -> bool
pub fn is_identical(&self, other: &Self) -> bool
Returns true if the fingerprint is identical (no changes at all).
Sourcepub const fn might_affect_layout(&self, other: &Self) -> bool
pub const fn might_affect_layout(&self, other: &Self) -> bool
Quick check: could this change affect layout?
Sourcepub const fn might_affect_visuals(&self, other: &Self) -> bool
pub const fn might_affect_visuals(&self, other: &Self) -> bool
Quick check: could this change affect visuals at all?
Trait Implementations§
Source§impl Clone for NodeDataFingerprint
impl Clone for NodeDataFingerprint
Source§fn clone(&self) -> NodeDataFingerprint
fn clone(&self) -> NodeDataFingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more