Enum sauron::vdom::PatchType

source ·
pub enum PatchType<'a, MSG> {
    InsertBeforeNode {
        nodes: Vec<Cow<'a, Node<MSG>>>,
    },
    InsertAfterNode {
        nodes: Vec<&'a Node<MSG>>,
    },
    AppendChildren {
        children: Vec<&'a Node<MSG>>,
    },
    ClearChildren,
    RemoveNode,
    MoveBeforeNode {
        nodes_path: Vec<TreePath>,
    },
    MoveAfterNode {
        nodes_path: Vec<TreePath>,
    },
    ReplaceNode {
        replacement: Vec<&'a Node<MSG>>,
    },
    AddAttributes {
        attrs: Vec<&'a Attribute<MSG>>,
    },
    RemoveAttributes {
        attrs: Vec<&'a Attribute<MSG>>,
    },
}
Expand description

the patch variant

Variants§

§

InsertBeforeNode

insert the nodes before the node at patch_path

Fields

§nodes: Vec<Cow<'a, Node<MSG>>>

the nodes to be inserted before patch_path

§

InsertAfterNode

insert the nodes after the node at patch_path

Fields

§nodes: Vec<&'a Node<MSG>>

the nodes to be inserted after the patch_path

§

AppendChildren

Append a vector of child nodes to a parent node id at patch_path

Fields

§children: Vec<&'a Node<MSG>>

children nodes to be appended and their corresponding new_node_idx

§

ClearChildren

clear the chilren of this node,

§

RemoveNode

remove the target node

§

MoveBeforeNode

remove the nodes pointed at these nodes_path and move them before target_element pointed at patch_path

Fields

§nodes_path: Vec<TreePath>

before this target location

§

MoveAfterNode

remove the the nodes pointed at these nodes_path and move them after the target_element pointed at patch_path

Fields

§nodes_path: Vec<TreePath>

after this target location

§

ReplaceNode

ReplaceNode a node with another node. This typically happens when a node’s tag changes. ex:

becomes

Fields

§replacement: Vec<&'a Node<MSG>>

the node that will replace the target node

§

AddAttributes

Add attributes that the new node has that the old node does not Note: the attributes is not a reference since attributes of same name are merged to produce a new unify attribute

Fields

§attrs: Vec<&'a Attribute<MSG>>

the attributes to be patched into the target node

§

RemoveAttributes

Remove attributes that the old node had that the new node doesn’t

Fields

§attrs: Vec<&'a Attribute<MSG>>

attributes that are to be removed from this target node

Implementations§

source§

impl<'a, MSG> PatchType<'a, MSG>

source

pub fn map_msg<F, MSG2>(self, cb: F) -> PatchType<'a, MSG2>
where F: Fn(MSG) -> MSG2 + Clone + 'static, MSG2: 'static, MSG: 'static,

map the msg of this patch_type such that PatchType<MSG> becomes PatchType<MSG2>

Trait Implementations§

source§

impl<'a, MSG> Clone for PatchType<'a, MSG>

source§

fn clone(&self) -> PatchType<'a, MSG>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a, MSG> Debug for PatchType<'a, MSG>

source§

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

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

impl<'a, MSG> PartialEq for PatchType<'a, MSG>

source§

fn eq(&self, __other: &PatchType<'a, MSG>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, MSG> Eq for PatchType<'a, MSG>

Auto Trait Implementations§

§

impl<'a, MSG> Freeze for PatchType<'a, MSG>

§

impl<'a, MSG> !RefUnwindSafe for PatchType<'a, MSG>

§

impl<'a, MSG> !Send for PatchType<'a, MSG>

§

impl<'a, MSG> !Sync for PatchType<'a, MSG>

§

impl<'a, MSG> Unpin for PatchType<'a, MSG>

§

impl<'a, MSG> !UnwindSafe for PatchType<'a, MSG>

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

§

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

§

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

§

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.