Enum GenericExpr
pub enum GenericExpr<Head, Leaf> {
Var(Span, Leaf),
Call(Span, Head, Vec<GenericExpr<Head, Leaf>>),
Lit(Span, Literal),
}Variants§
Implementations§
§impl<Head, Leaf> GenericExpr<Head, Leaf>
impl<Head, Leaf> GenericExpr<Head, Leaf>
pub fn visit_vars(&self, f: &mut impl FnMut(&Span, &Leaf))
pub fn span(&self) -> Span
pub fn is_var(&self) -> bool
pub fn get_var(&self) -> Option<Leaf>
pub fn ast_size(&self) -> usize
pub fn walk( &self, pre: &mut impl FnMut(&GenericExpr<Head, Leaf>), post: &mut impl FnMut(&GenericExpr<Head, Leaf>), )
pub fn fold<Out>( &self, f: &mut impl FnMut(&GenericExpr<Head, Leaf>, Vec<Out>) -> Out, ) -> Out
pub fn visit_exprs(
self,
f: &mut impl FnMut(GenericExpr<Head, Leaf>) -> GenericExpr<Head, Leaf>,
) -> GenericExpr<Head, Leaf>
pub fn visit_exprs( self, f: &mut impl FnMut(GenericExpr<Head, Leaf>) -> GenericExpr<Head, Leaf>, ) -> GenericExpr<Head, Leaf>
Applys f to all sub-expressions (including self)
bottom-up, collecting the results.
pub fn subst<Head2, Leaf2>(
&self,
subst_leaf: &mut impl FnMut(&Span, &Leaf) -> GenericExpr<Head2, Leaf2>,
subst_head: &mut impl FnMut(&Head) -> Head2,
) -> GenericExpr<Head2, Leaf2>
pub fn subst<Head2, Leaf2>( &self, subst_leaf: &mut impl FnMut(&Span, &Leaf) -> GenericExpr<Head2, Leaf2>, subst_head: &mut impl FnMut(&Head) -> Head2, ) -> GenericExpr<Head2, Leaf2>
subst replaces occurrences of variables and head symbols in the expression.
pub fn subst_leaf<Leaf2>( &self, subst_leaf: &mut impl FnMut(&Span, &Leaf) -> GenericExpr<Head, Leaf2>, ) -> GenericExpr<Head, Leaf2>
pub fn vars(&self) -> impl Iterator<Item = Leaf>
Trait Implementations§
§impl<Head, Leaf> Clone for GenericExpr<Head, Leaf>
impl<Head, Leaf> Clone for GenericExpr<Head, Leaf>
§fn clone(&self) -> GenericExpr<Head, Leaf>
fn clone(&self) -> GenericExpr<Head, Leaf>
Returns a copy 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 more§impl<Head, Leaf> Debug for GenericExpr<Head, Leaf>
impl<Head, Leaf> Debug for GenericExpr<Head, Leaf>
§impl<Head, Leaf> Display for GenericExpr<Head, Leaf>
impl<Head, Leaf> Display for GenericExpr<Head, Leaf>
§impl<Head, Leaf> Hash for GenericExpr<Head, Leaf>
impl<Head, Leaf> Hash for GenericExpr<Head, Leaf>
§impl<Head, Leaf> PartialEq for GenericExpr<Head, Leaf>
impl<Head, Leaf> PartialEq for GenericExpr<Head, Leaf>
impl<Head, Leaf> Eq for GenericExpr<Head, Leaf>
impl<Head, Leaf> StructuralPartialEq for GenericExpr<Head, Leaf>
Auto Trait Implementations§
impl<Head, Leaf> Freeze for GenericExpr<Head, Leaf>
impl<Head, Leaf> RefUnwindSafe for GenericExpr<Head, Leaf>where
Leaf: RefUnwindSafe,
Head: RefUnwindSafe,
impl<Head, Leaf> Send for GenericExpr<Head, Leaf>
impl<Head, Leaf> Sync for GenericExpr<Head, Leaf>
impl<Head, Leaf> Unpin for GenericExpr<Head, Leaf>
impl<Head, Leaf> UnwindSafe for GenericExpr<Head, Leaf>where
Leaf: UnwindSafe,
Head: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
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