Skip to main content

PatchOp

Enum PatchOp 

Source
pub enum PatchOp {
    Insert {
        dest: RankedDest,
        node: PatchNode,
    },
    Put {
        slot: SlotRef,
        node: PatchNode,
    },
    Replace {
        target_id: NodeId,
        replacement: PatchNode,
    },
    Delete {
        target_id: NodeId,
    },
    Move {
        target_id: NodeId,
        dest: PatchDest,
    },
    Set {
        path: PatchPath,
        value: PatchValue,
    },
    Clear {
        path: PatchPath,
    },
    Attach {
        node_id: NodeId,
        target_id: NodeId,
    },
    Detach {
        node_id: NodeId,
    },
}
Expand description

Structured patch operation over the Draxl semantic model.

Variants§

§

Insert

Inserts a new child into a ranked slot.

Fields

§dest: RankedDest

Ranked destination that owns the inserted child.

§node: PatchNode

Node to insert.

§

Put

Fills or replaces a single-child slot.

Fields

§slot: SlotRef

Slot to fill.

§node: PatchNode

Node to install into the slot.

§

Replace

Rewrites an existing node payload while preserving its outer shell.

Fields

§target_id: NodeId

Stable id of the node to rewrite.

§replacement: PatchNode

Replacement fragment for the node body.

§

Delete

Removes an existing node.

Fields

§target_id: NodeId

Stable id of the node to delete.

§

Move

Relocates an existing node while preserving its identity.

Fields

§target_id: NodeId

Stable id of the node to move.

§dest: PatchDest

New destination for the node.

§

Set

Updates a scalar field or metadata path.

Fields

§path: PatchPath

Path to update.

§value: PatchValue

New scalar value.

§

Clear

Clears an optional scalar field or metadata path.

Fields

§path: PatchPath

Path to clear.

§

Attach

Attaches a doc or comment node to a semantic target.

Fields

§node_id: NodeId

Attachable node id.

§target_id: NodeId

Target node id.

§

Detach

Detaches a doc or comment node.

Fields

§node_id: NodeId

Attachable node id.

Trait Implementations§

Source§

impl Clone for PatchOp

Source§

fn clone(&self) -> PatchOp

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 PatchOp

Source§

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

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

impl Eq for PatchOp

Source§

impl PartialEq for PatchOp

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PatchOp

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 = 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.