Enum Patch

Source
pub enum Patch {
    UpdateAttr {
        path: Vec<String>,
        id: NodeId,
        old: Attrs,
        new: Attrs,
    },
    AddNode {
        path: Vec<String>,
        parent_id: NodeId,
        nodes: Vec<Node>,
    },
    AddMark {
        path: Vec<String>,
        node_id: NodeId,
        marks: Vec<Mark>,
    },
    RemoveMark {
        path: Vec<String>,
        parent_id: NodeId,
        marks: Vec<Mark>,
    },
    RemoveNode {
        path: Vec<String>,
        parent_id: NodeId,
        nodes: Vec<Node>,
    },
    MoveNode {
        path: Vec<String>,
        node_id: NodeId,
        source_parent_id: NodeId,
        target_parent_id: NodeId,
        position: Option<usize>,
    },
    SortChildren {
        path: Vec<String>,
        parent_id: NodeId,
        old_children: Vec<NodeId>,
        new_children: Vec<NodeId>,
    },
}
Expand description

文档补丁枚举 用于描述对文档树的各种修改操作

Variants§

§

UpdateAttr

更新节点属性

Fields

§path: Vec<String>

节点路径,用于定位节点位置

§id: NodeId

目标节点的唯一标识符

§old: Attrs

更新前的属性映射

§new: Attrs

更新后的属性映射

§

AddNode

添加新节点

Fields

§path: Vec<String>

新节点的路径

§parent_id: NodeId

父节点的唯一标识符

§nodes: Vec<Node>

要添加的节点

§

AddMark

添加标记

Fields

§path: Vec<String>

目标节点的路径

§node_id: NodeId

目标节点的唯一标识符

§marks: Vec<Mark>

要添加的标记

§

RemoveMark

移除标记

Fields

§path: Vec<String>

目标节点的路径

§parent_id: NodeId

父节点的唯一标识符

§marks: Vec<Mark>

要移除的标记列表

§

RemoveNode

移除节点

Fields

§path: Vec<String>

目标节点的路径

§parent_id: NodeId

父节点的唯一标识符

§nodes: Vec<Node>

要移除的节点列表

§

MoveNode

移动节点

Fields

§path: Vec<String>
§node_id: NodeId
§source_parent_id: NodeId
§target_parent_id: NodeId
§position: Option<usize>
§

SortChildren

排序子节点

Fields

§path: Vec<String>

目标节点的路径

§parent_id: NodeId

父节点的唯一标识符

§old_children: Vec<NodeId>

排序前的子节点列表

§new_children: Vec<NodeId>

排序后的子节点列表

Trait Implementations§

Source§

impl Clone for Patch

Source§

fn clone(&self) -> Patch

Returns a duplicate 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 Debug for Patch

Source§

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

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

impl<'de> Deserialize<'de> for Patch

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Patch

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Patch

§

impl RefUnwindSafe for Patch

§

impl Send for Patch

§

impl Sync for Patch

§

impl Unpin for Patch

§

impl UnwindSafe for Patch

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,