Enum evaltrees::ast::Pattern [−][src]
pub enum Pattern<Aux> { Binding(Symbol, Aux), Cons(Box<Pattern<Aux>>, Box<Pattern<Aux>>, Aux), Literal(Literal, Aux), }
A pattern.
Variants
Binding(Symbol, Aux)
A name.
Cons(Box<Pattern<Aux>>, Box<Pattern<Aux>>, Aux)
A cons.
Literal(Literal, Aux)
A literal value.
Methods
impl<Aux> Pattern<Aux>
[src]
impl<Aux> Pattern<Aux>
pub fn aux_ref(&self) -> &Aux
[src]
pub fn aux_ref(&self) -> &Aux
Gets the auxiliary data as a reference.
pub fn freevars(&self) -> BTreeSet<Symbol>
[src]
pub fn freevars(&self) -> BTreeSet<Symbol>
Returns the bound variables of a pattern.
pub fn map_aux<Aux2, F: Copy + Fn(Aux) -> Aux2>(self, f: F) -> Pattern<Aux2>
[src]
pub fn map_aux<Aux2, F: Copy + Fn(Aux) -> Aux2>(self, f: F) -> Pattern<Aux2>
Modifies the aux value, recursively.
impl<Aux: Clone> Pattern<Aux>
[src]
impl<Aux: Clone> Pattern<Aux>
pub fn matches(&self, expr: &Expr<Aux>) -> Option<BTreeMap<Symbol, Expr<Aux>>>
[src]
pub fn matches(&self, expr: &Expr<Aux>) -> Option<BTreeMap<Symbol, Expr<Aux>>>
Returns the bindings from the match between the pattern and the expression, if possible.
Returns None
if the pattern and expression do not unify. Will probably return None
if
the expression is not in normal form.
impl<Aux: Clone> Pattern<Aux>
[src]
impl<Aux: Clone> Pattern<Aux>
Trait Implementations
impl<Aux> Display for Pattern<Aux>
[src]
impl<Aux> Display for Pattern<Aux>
fn fmt(&self, fmt: &mut Formatter) -> FmtResult
[src]
fn fmt(&self, fmt: &mut Formatter) -> FmtResult
Formats the value using the given formatter. Read more
impl<Aux: Clone> Clone for Pattern<Aux>
[src]
impl<Aux: Clone> Clone for Pattern<Aux>
fn clone(&self) -> Pattern<Aux>
[src]
fn clone(&self) -> Pattern<Aux>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<Aux: Debug> Debug for Pattern<Aux>
[src]
impl<Aux: Debug> Debug for Pattern<Aux>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<Aux: PartialEq> PartialEq for Pattern<Aux>
[src]
impl<Aux: PartialEq> PartialEq for Pattern<Aux>