Struct bnf::Expression [] [src]

pub struct Expression { /* fields omitted */ }

An Expression is comprised of any number of Terms

Methods

impl Expression
[src]

[src]

Construct a new Expression

[src]

Construct an Expression from Terms

[src]

[src]

Add Term to Expression

[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"),
    }

}

[src]

Get iterator of Terms within Expression

[src]

Get mutable iterator of Terms within Expression

Trait Implementations

impl PartialEq for Expression
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Debug for Expression
[src]

[src]

Formats the value using the given formatter.

impl Clone for Expression
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for Expression
[src]

[src]

Formats the value using the given formatter. Read more

impl FromStr for Expression
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more