[−][src]Struct bnf::Expression
An Expression is comprised of any number of Terms
Methods
impl Expression
[src]
pub fn new() -> Expression
[src]
Construct a new Expression
pub fn from_parts(v: Vec<Term>) -> Expression
[src]
Construct an Expression
from Term
s
pub fn add_term(&mut self, term: Term)
[src]
Add Term
to Expression
pub 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"), } }
pub fn terms_iter(&self) -> Iter
[src]
Get iterator of Term
s within Expression
pub fn terms_iter_mut(&mut self) -> IterMut
[src]
Get mutable iterator of Term
s within Expression
Trait Implementations
impl Clone for Expression
[src]
fn clone(&self) -> Expression
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for Expression
[src]
fn default() -> Expression
[src]
impl Eq for Expression
[src]
impl PartialEq<Expression> for Expression
[src]
fn eq(&self, other: &Expression) -> bool
[src]
fn ne(&self, other: &Expression) -> bool
[src]
impl Display for Expression
[src]
impl Debug for Expression
[src]
impl FromStr for Expression
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for Expression
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for Expression
[src]
impl StructuralEq for Expression
[src]
Auto Trait Implementations
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
impl RefUnwindSafe for Expression
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,