pub enum Edit<L: Lang> {
Replace {
target: L::Id,
with: L::Id,
},
Delete {
node: L::Id,
},
Splice {
node: L::Id,
index: usize,
remove: usize,
insert: Vec<L::Id>,
},
Multi(Vec<Edit<L>>),
}Expand description
一次结构编辑提案。
Variants§
Replace
用 with 子树替换 target 节点(target 必须有父节点)。
Delete
删除一个节点(其父从 children 中移除该槽位)。
Splice
对 node 自身的 children 做切片编辑。
Multi(Vec<Edit<L>>)
多个编辑按序原子应用。 约束:前面的编辑不得使后面编辑的 (parent, index) 失效—— 先替换靠后的节点、后删除靠前的节点是安全顺序。
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<L> Freeze for Edit<L>
impl<L> RefUnwindSafe for Edit<L>where
<L as Lang>::Id: RefUnwindSafe,
Vec<<L as Lang>::Id>: RefUnwindSafe,
Vec<Edit<L>>: RefUnwindSafe,
impl<L> Send for Edit<L>
impl<L> Sync for Edit<L>
impl<L> Unpin for Edit<L>
impl<L> UnsafeUnpin for Edit<L>
impl<L> UnwindSafe for Edit<L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more