Struct cfg::rule::builder::RuleBuilder

source ·
pub struct RuleBuilder<C>where
    C: RuleContainer,{ /* private fields */ }
Expand description

The rule builder.

Implementations§

source§

impl<C> RuleBuilder<C>where C: RuleContainer,

source

pub fn new(rules: C) -> RuleBuilder<C>

Creates a rule builder.

source§

impl<C> RuleBuilder<C>where C: RuleContainer,

source

pub fn rule(self, lhs: Symbol) -> Self

Starts building a new rule with the given LHS.

source

pub fn history(self, history: HistoryId) -> Self

Assigns the rule history, which is used on the next call to rhs, or overwritten by a call to rhs_with_history.

source

pub fn rhs<S>(self, syms: S) -> Selfwhere S: AsRef<[Symbol]>,

Adds a rule alternative to the grammar. If history wasn’t provided, the rule has the Default history.

source

pub fn rhs_with_history<Sr>(self, syms: Sr, history_id: HistoryId) -> Selfwhere Sr: AsRef<[Symbol]>,

Adds a rule alternative with the given RHS and history to the grammar.

source

pub fn rhs_with_linked_history<Sr>( self, syms: Sr, linked_history: LinkedHistoryNode ) -> Selfwhere Sr: AsRef<[Symbol]>,

Adds a rule alternative with the given RHS and history to the grammar.

source

pub fn precedenced_rule(self, lhs: Symbol) -> PrecedencedRuleBuilder<C>

Starts building a new precedenced rule.

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for RuleBuilder<C>where C: RefUnwindSafe,

§

impl<C> Send for RuleBuilder<C>where C: Send,

§

impl<C> Sync for RuleBuilder<C>where C: Sync,

§

impl<C> Unpin for RuleBuilder<C>where C: Unpin,

§

impl<C> UnwindSafe for RuleBuilder<C>where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.