pub enum RuleActionSpec {
Replace {
from: Vec<usize>,
to: Vec<usize>,
},
Swap {
swap: (Vec<usize>, Vec<usize>),
},
Rewrite {
base: Node,
replace: Vec<(Vec<usize>, Vec<usize>)>,
fold: Vec<Vec<usize>>,
},
Multi(Vec<Self>),
}Expand description
Describes the action to perform when a rule matches.
Variants§
Replace
Overwrite a part of the AST with a node elsewhere in the AST.
Fields
§
from: Vec<usize>The indexing sequence to fetch the node to be written.
See AstNode::get for more details on indexing.
§
to: Vec<usize>The indexing sequence the node should be written to.
See AstNode::get for more details on indexing.
Swap
Swaps two nodes in the AST.
Rewrite
Constructs a replacement node by starting from some base and performing actions against it from the original node.
Multi(Vec<Self>)
Perform multiple actions in order.
Implementations§
Trait Implementations§
Source§impl Clone for RuleActionSpec
impl Clone for RuleActionSpec
Source§fn clone(&self) -> RuleActionSpec
fn clone(&self) -> RuleActionSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuleActionSpec
impl Debug for RuleActionSpec
Source§impl<'de> Deserialize<'de> for RuleActionSpec
impl<'de> Deserialize<'de> for RuleActionSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for RuleActionSpec
impl PartialEq for RuleActionSpec
Source§fn eq(&self, other: &RuleActionSpec) -> bool
fn eq(&self, other: &RuleActionSpec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for RuleActionSpec
impl StructuralPartialEq for RuleActionSpec
Auto Trait Implementations§
impl Freeze for RuleActionSpec
impl RefUnwindSafe for RuleActionSpec
impl Send for RuleActionSpec
impl Sync for RuleActionSpec
impl Unpin for RuleActionSpec
impl UnsafeUnpin for RuleActionSpec
impl UnwindSafe for RuleActionSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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