pub enum SketchNode<L> {
Any,
Node(L),
Contains(Id),
OnlyContains(Id),
Or(Vec<Id>),
}
Expand description
The language of Sketch
es.
Variants§
Any
Any program of the underlying [Language
].
Corresponds to the ?
syntax.
Node(L)
Programs made from this [Language
] node whose children satisfy the given sketches.
Corresponds to the (language_node s1 .. sn)
syntax.
Contains(Id)
Programs that contain at least one sub-program satisfying the given sketch.
Corresponds to the (contains s)
syntax.
OnlyContains(Id)
Programs that only contain sub-programs satisfying the given sketch.
Corresponds to the (onlyContains s)
syntax.
Or(Vec<Id>)
Programs that satisfy any of these sketches.
Corresponds to the (or s1 .. sn)
syntax.
Trait Implementations§
Source§impl<L: Clone> Clone for SketchNode<L>
impl<L: Clone> Clone for SketchNode<L>
Source§fn clone(&self) -> SketchNode<L>
fn clone(&self) -> SketchNode<L>
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 moreSource§impl<L: Debug> Debug for SketchNode<L>
impl<L: Debug> Debug for SketchNode<L>
Source§impl<L: Language + Display> Display for SketchNode<L>
impl<L: Language + Display> Display for SketchNode<L>
Source§impl<L: FromOp> FromOp for SketchNode<L>
impl<L: FromOp> FromOp for SketchNode<L>
Source§impl<L: Hash> Hash for SketchNode<L>
impl<L: Hash> Hash for SketchNode<L>
Source§impl<L: Language> Language for SketchNode<L>
impl<L: Language> Language for SketchNode<L>
Source§type Discriminant = SketchDiscriminant<L>
type Discriminant = SketchDiscriminant<L>
Type representing the cases of this language. Read more
Source§fn discriminant(&self) -> Self::Discriminant
fn discriminant(&self) -> Self::Discriminant
Return the
Discriminant
of this node.Source§fn matches(&self, _other: &Self) -> bool
fn matches(&self, _other: &Self) -> bool
Returns true if this enode matches another enode.
This should only consider the operator and the arity,
not the children
Id
s.Source§fn children_mut(&mut self) -> &mut [Id]
fn children_mut(&mut self) -> &mut [Id]
Returns a mutable slice of the children of this e-node.
§fn for_each_mut<F>(&mut self, f: F)where
F: FnMut(&mut Id),
fn for_each_mut<F>(&mut self, f: F)where
F: FnMut(&mut Id),
Runs a given function on each child
Id
, allowing mutation of that Id
.§fn try_for_each<E, F>(&self, f: F) -> Result<(), E>
fn try_for_each<E, F>(&self, f: F) -> Result<(), E>
Runs a falliable function on each child, stopping if the function returns
an error.
§fn update_children<F>(&mut self, f: F)where
F: FnMut(Id) -> Id,
fn update_children<F>(&mut self, f: F)where
F: FnMut(Id) -> Id,
Runs a given function to replace the children.
§fn map_children<F>(self, f: F) -> Selfwhere
F: FnMut(Id) -> Id,
fn map_children<F>(self, f: F) -> Selfwhere
F: FnMut(Id) -> Id,
Creates a new enode with children determined by the given function.
§fn all<F>(&self, f: F) -> bool
fn all<F>(&self, f: F) -> bool
Returns true if the predicate is true on all children.
Does not short circuit.
§fn any<F>(&self, f: F) -> bool
fn any<F>(&self, f: F) -> bool
Returns true if the predicate is true on any children.
Does not short circuit.
§fn join_recexprs<F, Expr>(&self, child_recexpr: F) -> RecExpr<Self>
fn join_recexprs<F, Expr>(&self, child_recexpr: F) -> RecExpr<Self>
§fn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self>where
F: FnMut(Id) -> Self,
fn build_recexpr<F>(&self, get_node: F) -> RecExpr<Self>where
F: FnMut(Id) -> Self,
Build a [
RecExpr
] from an e-node. Read more§fn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<Self>, Err>
fn try_build_recexpr<F, Err>(&self, get_node: F) -> Result<RecExpr<Self>, Err>
Same as [
Language::build_recexpr
], but fallible.Source§impl<L: Ord> Ord for SketchNode<L>
impl<L: Ord> Ord for SketchNode<L>
Source§fn cmp(&self, other: &SketchNode<L>) -> Ordering
fn cmp(&self, other: &SketchNode<L>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<L: PartialEq> PartialEq for SketchNode<L>
impl<L: PartialEq> PartialEq for SketchNode<L>
Source§impl<L: PartialOrd> PartialOrd for SketchNode<L>
impl<L: PartialOrd> PartialOrd for SketchNode<L>
impl<L: Eq> Eq for SketchNode<L>
impl<L> StructuralPartialEq for SketchNode<L>
Auto Trait Implementations§
impl<L> Freeze for SketchNode<L>where
L: Freeze,
impl<L> RefUnwindSafe for SketchNode<L>where
L: RefUnwindSafe,
impl<L> Send for SketchNode<L>where
L: Send,
impl<L> Sync for SketchNode<L>where
L: Sync,
impl<L> Unpin for SketchNode<L>where
L: Unpin,
impl<L> UnwindSafe for SketchNode<L>where
L: UnwindSafe,
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
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.