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,
}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 other attributes (contenteditable, tab_index, dataset)
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 fn diff(&self, other: &NodeDataFingerprint) -> NodeChangeSet
pub fn diff(&self, other: &NodeDataFingerprint) -> NodeChangeSet
Returns a quick NodeChangeSet by comparing two fingerprints. This is O(1) — just comparing 6 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: &NodeDataFingerprint) -> bool
pub fn is_identical(&self, other: &NodeDataFingerprint) -> bool
Returns true if the fingerprint is identical (no changes at all).
Sourcepub fn might_affect_layout(&self, other: &NodeDataFingerprint) -> bool
pub fn might_affect_layout(&self, other: &NodeDataFingerprint) -> bool
Quick check: could this change affect layout?
Sourcepub fn might_affect_visuals(&self, other: &NodeDataFingerprint) -> bool
pub fn might_affect_visuals(&self, other: &NodeDataFingerprint) -> 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 moreSource§impl Debug for NodeDataFingerprint
impl Debug for NodeDataFingerprint
Source§impl Default for NodeDataFingerprint
impl Default for NodeDataFingerprint
Source§impl Hash for NodeDataFingerprint
impl Hash for NodeDataFingerprint
Source§impl PartialEq for NodeDataFingerprint
impl PartialEq for NodeDataFingerprint
Source§fn eq(&self, other: &NodeDataFingerprint) -> bool
fn eq(&self, other: &NodeDataFingerprint) -> bool
self and other values to be equal, and is used by ==.