Struct lamcal::environment::Environment [−][src]
pub struct Environment { /* fields omitted */ }
The environment in which lambda terms get evaluated.
There are two possibilities to create an instance of Environment
:
Environment::new()
- creates an empty environment.Environment::default()
- creates an environment containing predefined bindings to all the builtin standard terms, combinators and data encoding terms.
Methods
impl Environment
[src]
impl Environment
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new empty environment.
The empty environment does not contain any bindings at all. If you want
to create an environment with predefined bindings to all the builtin
standard terms, combinators and data encodings use the
Environment::default()
function.
pub fn insert_binding(&mut self, binding: Binding)
[src]
pub fn insert_binding(&mut self, binding: Binding)
Adds the given binding to this environment.
pub fn bind(&mut self, name: VarName, term: Term) -> Option<Term>
[src]
pub fn bind(&mut self, name: VarName, term: Term) -> Option<Term>
Adds a new binding of the given term to the given name to this environment.
pub fn unbind(&mut self, name: &VarName) -> Option<Term>
[src]
pub fn unbind(&mut self, name: &VarName) -> Option<Term>
Removes the binding to the given name from this environment and returns the bound term if such a binding previously existed.
pub fn clear_bindings(&mut self)
[src]
pub fn clear_bindings(&mut self)
Removes all bindings from this environment.
pub fn bindings(
&self
) -> impl Iterator<Item = (&VarName, &Term)>
[src]
pub fn bindings(
&self
) -> impl Iterator<Item = (&VarName, &Term)>
Returns an iterator over all bindings defined in this environment.
The iterator issues the items in an arbitrary order.
pub fn into_bindings(
self
) -> impl Iterator<Item = Binding>
[src]
pub fn into_bindings(
self
) -> impl Iterator<Item = Binding>
Returns an iterator over all bindings defined in this environment.
pub fn lookup_term(&self, name: &VarName) -> Option<&Term>
[src]
pub fn lookup_term(&self, name: &VarName) -> Option<&Term>
Looks up the binding for a name and returns a reference to the bound term if a binding exists for the given name.
Trait Implementations
impl Debug for Environment
[src]
impl Debug for Environment
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 Environment
[src]
impl Clone for Environment
fn clone(&self) -> Environment
[src]
fn clone(&self) -> Environment
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 Environment
[src]
impl PartialEq for Environment
fn eq(&self, other: &Environment) -> bool
[src]
fn eq(&self, other: &Environment) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Environment) -> bool
[src]
fn ne(&self, other: &Environment) -> bool
This method tests for !=
.
impl FromIterator<(VarName, Term)> for Environment
[src]
impl FromIterator<(VarName, Term)> for Environment
fn from_iter<I>(set: I) -> Self where
I: IntoIterator<Item = (VarName, Term)>,
[src]
fn from_iter<I>(set: I) -> Self where
I: IntoIterator<Item = (VarName, Term)>,
Creates a value from an iterator. Read more
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<(VarName, Term)> for Environment
[src]
impl Extend<(VarName, Term)> for Environment
fn extend<I: IntoIterator<Item = (VarName, Term)>>(&mut self, iter: I)
[src]
fn extend<I: IntoIterator<Item = (VarName, Term)>>(&mut self, iter: I)
Extends a collection with the contents of 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 Default for Environment
[src]
impl Default for Environment
Auto Trait Implementations
impl Send for Environment
impl Send for Environment
impl Sync for Environment
impl Sync for Environment