pub enum TransformOperation {
ReplaceNode {
target: NodeId,
new_node: AstNode,
},
InsertChild {
parent: NodeId,
child: AstNode,
position: Option<usize>,
},
RemoveNode {
target: NodeId,
preserve_children: bool,
},
MoveNode {
target: NodeId,
new_parent: NodeId,
position: Option<usize>,
},
UpdateValue {
target: NodeId,
new_value: PdfValue,
},
Batch(Vec<TransformOperation>),
}Expand description
Transform operation that can be applied to AST nodes
Variants§
ReplaceNode
Replace a node with a new node
InsertChild
Insert a new node as a child
RemoveNode
Remove a node
MoveNode
Move a node to a new parent
UpdateValue
Update node value
Batch(Vec<TransformOperation>)
Batch operation containing multiple operations
Implementations§
Source§impl TransformOperation
impl TransformOperation
Sourcepub fn apply(&self, graph: &mut PdfAstGraph) -> AstResult<()>
pub fn apply(&self, graph: &mut PdfAstGraph) -> AstResult<()>
Apply this operation to the graph
Sourcepub fn insert_at(parent: NodeId, child: AstNode, position: usize) -> Self
pub fn insert_at(parent: NodeId, child: AstNode, position: usize) -> Self
Create an insert operation at specific position
Sourcepub fn remove_preserve_children(target: NodeId) -> Self
pub fn remove_preserve_children(target: NodeId) -> Self
Create a remove operation that preserves children
Sourcepub fn move_to_position(
target: NodeId,
new_parent: NodeId,
position: usize,
) -> Self
pub fn move_to_position( target: NodeId, new_parent: NodeId, position: usize, ) -> Self
Create a move operation to specific position
Sourcepub fn update_value(target: NodeId, new_value: PdfValue) -> Self
pub fn update_value(target: NodeId, new_value: PdfValue) -> Self
Create an update value operation
Sourcepub fn batch(operations: Vec<TransformOperation>) -> Self
pub fn batch(operations: Vec<TransformOperation>) -> Self
Create a batch operation
Trait Implementations§
Source§impl Clone for TransformOperation
impl Clone for TransformOperation
Source§fn clone(&self) -> TransformOperation
fn clone(&self) -> TransformOperation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransformOperation
impl RefUnwindSafe for TransformOperation
impl Send for TransformOperation
impl Sync for TransformOperation
impl Unpin for TransformOperation
impl UnwindSafe for TransformOperation
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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