Skip to main content

Mutation

Enum Mutation 

Source
#[non_exhaustive]
pub enum Mutation { AttributeChanged { id: NodeId, name: String, old: Option<String>, new: Option<String>, }, ClassChanged { id: NodeId, added: Vec<String>, removed: Vec<String>, }, ChildListChanged { parent: NodeId, added: Vec<NodeId>, removed: Vec<NodeId>, }, CharacterDataChanged { id: NodeId, old: String, new: String, }, InteractionChanged { prev: Option<NodeId>, next: Option<NodeId>, kind: InteractionKind, }, SelectionChanged { prev: Option<Selection>, next: Option<Selection>, }, PreDetach { detached_root: NodeId, focused: Option<NodeId>, hovered: Option<NodeId>, }, }
Expand description

One DOM mutation notification.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

AttributeChanged

set_attribute / remove_attribute / toggle_attribute. old == None && new.is_some() → attribute added. old.is_some() && new == None → attribute removed. Both Some → value changed.

Fields

§name: String
§

ClassChanged

One class was added or removed. add_class / remove_class / toggle_class each fire a single record with one entry in either added or removed; replace_class fires once with both populated.

Fields

§added: Vec<String>
§removed: Vec<String>
§

ChildListChanged

A parent’s child list was mutated. Fires once per top-level operation — e.g. append_child(parent, frag) where frag has three children fires three records, one per unwrapped child.

Fields

§parent: NodeId
§added: Vec<NodeId>
§removed: Vec<NodeId>
§

CharacterDataChanged

Text or Comment node data changed.

Fields

§

InteractionChanged

Hovered or focused node changed. Both prev and next may be Some (re-pointed), either may be None (cleared or set-from- nothing). The cascade dirty-tracker uses this to invalidate both sides’ subtrees for :hover / :focus re-matching.

§

SelectionChanged

Document selection changed via Dom::set_selection. Either prev or next may be None; cleared selections fire next: None. Paint observers use this to invalidate the ::selection overlay on the nodes whose range changed.

§

PreDetach

About to detach — fired in detach_from_parent BEFORE the structural unlink, so observers can dispatch implicit blur / focusout / mouseleave / mouseout events while the tree is still intact (the focused/hovered node’s parent_node() still walks the live ancestor chain).

focused is Some(id) iff dom.focused() was inside the subtree rooted at detached_root at the moment of detach. hovered likewise for hover. If neither is set, no PreDetach record is emitted (the structurally-cheap short-circuit path in purge_interaction_state_for_subtree also gates this record’s emission).

The subsequent InteractionChanged { next: None, kind } records still fire from the purge step — observers that only care about the post-detach state can listen to those. PreDetach is for observers that need to dispatch real DOM events with bubbling intact.

Fields

§detached_root: NodeId

Subtree root being detached.

§focused: Option<NodeId>

Pre-detach focused node, if it was inside the subtree.

§hovered: Option<NodeId>

Pre-detach hovered node, if it was inside the subtree.

Trait Implementations§

Source§

impl Clone for Mutation

Source§

fn clone(&self) -> Self

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 Mutation

Source§

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

Formats the value using the given formatter. Read more

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.