Skip to main content

NodeDataFingerprint

Struct NodeDataFingerprint 

Source
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: u64

Hash of node_type (Text content, Image ref, Div, etc.)

§state_hash: u64

Hash of styled_node_state (hover, focus, active bits)

§inline_css_hash: u64

Hash of inline CSS properties

§ids_classes_hash: u64

Hash of ids_and_classes

§callbacks_hash: u64

Hash of callbacks (event types + function pointers)

§attrs_hash: u64

Hash of other attributes (contenteditable, tab_index, dataset)

Implementations§

Source§

impl NodeDataFingerprint

Source

pub fn compute(node: &NodeData, styled_state: Option<&StyledNodeState>) -> Self

Compute a fingerprint from a node’s data and styled state.

Source

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.

Source

pub fn is_identical(&self, other: &NodeDataFingerprint) -> bool

Returns true if the fingerprint is identical (no changes at all).

Source

pub fn might_affect_layout(&self, other: &NodeDataFingerprint) -> bool

Quick check: could this change affect layout?

Source

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

Source§

fn clone(&self) -> NodeDataFingerprint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeDataFingerprint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NodeDataFingerprint

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Hash for NodeDataFingerprint

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NodeDataFingerprint

Source§

fn eq(&self, other: &NodeDataFingerprint) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for NodeDataFingerprint

Source§

impl Eq for NodeDataFingerprint

Source§

impl StructuralPartialEq for NodeDataFingerprint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetHash for T
where T: Hash,

Source§

fn get_hash(&self) -> u64

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.