pub struct Predicate {
pub op: Option<PredicateOp>,
pub not_op: Option<PredicateOp>,
pub const_value: Option<TyValue>,
pub equivalent: Vec<(Path, Path)>,
pub arity: Option<usize>,
pub children: Vec<Option<Self>>,
}Expand description
Describes a predicate on an AST node.
Fields§
§op: Option<PredicateOp>Match only on nodes performing the given operation.
not_op: Option<PredicateOp>Match only on nodes which are NOT the given operation.
const_value: Option<TyValue>Match if the node is a constant with some value.
equivalent: Vec<(Path, Path)>Match if the descendant nodes specified by the two paths are equal.
arity: Option<usize>Match if the descendant nodes have a certain number of children.
For piecewise functions, this describes the number of conditional arms.
children: Vec<Option<Self>>Match only on nodes whos children match the given predicates respectively.
A None value in some position means to skip considering the child in that
place, for instance a [None, Some(...)] skips evaluation of a first operand.
Implementations§
Source§impl Predicate
impl Predicate
Sourcepub fn op(op: PredicateOp) -> Self
pub fn op(op: PredicateOp) -> Self
Creates a predicate matching only on the specified op.
Trait Implementations§
impl Eq for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnsafeUnpin for Predicate
impl UnwindSafe for Predicate
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