Struct lamcal::environment::Binding [−][src]
pub struct Binding { /* fields omitted */ }
A binding definition.
It represents a lambda term bound to a name. Bindings are stored in an environment. When evaluating lambda terms names bound terms are looked up by name and replace the name with the bound term.
Bindings can be constructed programmatically using
Binding::new
or the more convenient
function bind
.
The parser of this crate also supports bindings. In the syntax of the
parser bindings are defined by let
statements. For more details see the
parse
function and the
the parser chapter in the crate documentation.
Methods
impl Binding
[src]
impl Binding
pub fn new(name: VarName, term: Term) -> Self
[src]
pub fn new(name: VarName, term: Term) -> Self
Constructs a new Binding
of given term to the given name.
pub fn unwrap(self) -> (VarName, Term)
[src]
pub fn unwrap(self) -> (VarName, Term)
Deconstruct this binding into its name and the bound term and returns both as a tuple.
pub fn name(&self) -> &VarName
[src]
pub fn name(&self) -> &VarName
Returns a reference to the name of this binding.
pub fn term(&self) -> &Term
[src]
pub fn term(&self) -> &Term
Returns a reference to the term that is bound by this binding's name.
Trait Implementations
impl FromIterator<Binding> for Environment
[src]
impl FromIterator<Binding> for Environment
fn from_iter<I>(set: I) -> Self where
I: IntoIterator<Item = Binding>,
[src]
fn from_iter<I>(set: I) -> Self where
I: IntoIterator<Item = Binding>,
Creates a value from an iterator. Read more
impl Extend<Binding> for Environment
[src]
impl Extend<Binding> for Environment
fn extend<I: IntoIterator<Item = Binding>>(&mut self, iter: I)
[src]
fn extend<I: IntoIterator<Item = Binding>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
impl Debug for Binding
[src]
impl Debug for Binding
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 Clone for Binding
[src]
impl Clone for Binding
fn clone(&self) -> Binding
[src]
fn clone(&self) -> Binding
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)
Performs copy-assignment from source
. Read more
impl PartialEq for Binding
[src]
impl PartialEq for Binding
fn eq(&self, other: &Binding) -> bool
[src]
fn eq(&self, other: &Binding) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Binding) -> bool
[src]
fn ne(&self, other: &Binding) -> bool
This method tests for !=
.
impl Eq for Binding
[src]
impl Eq for Binding
impl Hash for Binding
[src]
impl Hash for Binding
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Binding
[src]
impl Display for Binding
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 From<(VarName, Term)> for Binding
[src]
impl From<(VarName, Term)> for Binding