[][src]Enum liblet::production::ProductionPredicate

pub enum ProductionPredicate {
    LhsEquals(Vec<Symbol>),
    RhsEquals(Vec<Symbol>),
    RhsLengthEquals(usize),
    RhsIsSuffixOf(Vec<Symbol>),
}

A predicate for checking if production match some expected characteristics.

You can test a predicate on a Production by using the [test]: #method.test method.

Variants

LhsEquals(Vec<Symbol>)

It checks if the left hand side of the production equals the given ordered collection of symbols.

RhsEquals(Vec<Symbol>)

It checks if the right hand side of the production equals the given ordered collection of symbols.

RhsLengthEquals(usize)

It checks if the right hand side length (symbols count) of the production equals the given number.

RhsIsSuffixOf(Vec<Symbol>)

It checks if the right hand side of the production ends with the given ordered collection of symbols.

Methods

impl ProductionPredicate[src]

pub fn test(&self, p: &Production) -> bool[src]

Test if a production match the predicate

# Examples

use liblet::production::{ProductionPredicate, production};
use liblet::symbol::symbol;

// create a new production "A -> B C"
let p = production("A", "B C");
let rhs = vec![symbol("B"), symbol("C")];

assert!(ProductionPredicate::RhsEquals(rhs).test(&p));

Trait Implementations

impl Clone for ProductionPredicate[src]

impl Debug for ProductionPredicate[src]

impl Display for ProductionPredicate[src]

impl Eq for ProductionPredicate[src]

impl Hash for ProductionPredicate[src]

impl PartialEq<ProductionPredicate> for ProductionPredicate[src]

impl StructuralEq for ProductionPredicate[src]

impl StructuralPartialEq for ProductionPredicate[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.