Struct bnf::Expression
[−]
[src]
pub struct Expression { /* fields omitted */ }
An Expression is comprised of any number of Terms
Methods
impl Expression
[src]
fn new() -> Expression
[src]
Construct a new Expression
fn from_parts(v: Vec<Term>) -> Expression
[src]
Construct an Expression
from Term
s
fn from_str(s: &str) -> Result<Self, Error>
[src]
fn add_term(&mut self, term: Term)
[src]
Add Term
to Expression
fn remove_term(&mut self, term: &Term) -> Option<Term>
[src]
Remove Term
from Expression
If interested if Term
was removed, then inspect the returned Option
.
Example
extern crate bnf; use bnf::{Expression, Term}; fn main() { let mut expression = Expression::from_parts(vec![]); let to_remove = Term::Terminal(String::from("a_terminal")); let removed = expression.remove_term(&to_remove); match removed { Some(term) => println!("removed {}", term), None => println!("term was not in expression, so could not be removed"), } }
fn terms_iter(&self) -> Iter
[src]
Get iterator of Term
s within Expression
fn terms_iter_mut(&mut self) -> IterMut
[src]
Get mutable iterator of Term
s within Expression
Trait Implementations
impl PartialEq for Expression
[src]
fn eq(&self, __arg_0: &Expression) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Expression) -> bool
[src]
This method tests for !=
.
impl Debug for Expression
[src]
impl Clone for Expression
[src]
fn clone(&self) -> Expression
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Display for Expression
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more