Skip to main content

RuleBuilder

Struct RuleBuilder 

Source
pub struct RuleBuilder<Q1, A, Q2, B>
where Q1: RawState, Q2: RawState,
{ /* private fields */ }
Expand description

RuleBuilder is a utilitarian structure designed to facilitate the construction of new Rule instances through a step-by-step approach. This builder pattern allows for incremental specification of rule components, enhancing code readability and maintainability.

Implementations§

Source§

impl<Q1, Q2, A, B> RuleBuilder<Q1, A, Q2, B>
where Q1: RawState, Q2: RawState,

Source

pub const fn new() -> Self

initialize a new instance of the RuleBuilder

Source

pub fn direction(self, direction: Direction) -> Self

configure the direction

Source

pub fn left(self) -> Self

toggle the direction to the Left

Source

pub fn right(self) -> Self

toggle the direction to the Right

Source

pub fn stay(self) -> Self

toggle the direction to the Stay

Source

pub fn state<O>(self, state: State<O>) -> RuleBuilder<O, A, Q2, B>
where O: RawState,

configure the current state

Source

pub fn symbol<C>(self, symbol: C) -> RuleBuilder<Q1, C, Q2, B>

configure the current symbol

Source

pub fn next_state<O>(self, state: State<O>) -> RuleBuilder<Q1, A, O, B>
where O: RawState,

configure the next state

Source

pub fn write_symbol<C>(self, write_symbol: C) -> RuleBuilder<Q1, A, Q2, C>

configure the write symbol for the rule

Source

pub fn build(self) -> Rule<Q1, A, Q2, B>

consume the current instance to create a formal Rule

Trait Implementations§

Source§

impl<Q1, A: Default, Q2, B: Default> Default for RuleBuilder<Q1, A, Q2, B>
where Q1: RawState + Default, Q2: RawState + Default,

Source§

fn default() -> RuleBuilder<Q1, A, Q2, B>

Returns the “default value” for a type. Read more
Source§

impl<Q1, A, Q2, B> From<RuleBuilder<Q1, A, Q2, B>> for Rule<Q1, A, Q2, B>
where Q1: RawState, Q2: RawState,

Source§

fn from(builder: RuleBuilder<Q1, A, Q2, B>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<Q1, A, Q2, B> Freeze for RuleBuilder<Q1, A, Q2, B>
where A: Freeze, B: Freeze, Q1: Freeze, Q2: Freeze,

§

impl<Q1, A, Q2, B> RefUnwindSafe for RuleBuilder<Q1, A, Q2, B>

§

impl<Q1, A, Q2, B> Send for RuleBuilder<Q1, A, Q2, B>
where A: Send, B: Send, Q1: Send, Q2: Send,

§

impl<Q1, A, Q2, B> Sync for RuleBuilder<Q1, A, Q2, B>
where A: Sync, B: Sync, Q1: Sync, Q2: Sync,

§

impl<Q1, A, Q2, B> Unpin for RuleBuilder<Q1, A, Q2, B>
where A: Unpin, B: Unpin, Q1: Unpin, Q2: Unpin,

§

impl<Q1, A, Q2, B> UnwindSafe for RuleBuilder<Q1, A, Q2, B>
where A: UnwindSafe, B: UnwindSafe, Q1: UnwindSafe, Q2: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<Q, A, T> IntoHead<Q, A> for T
where T: Into<Head<Q, A>>,

Source§

fn into_head(self) -> Head<Q, A>

Source§

impl<U, Q> IntoState<Q> for U
where Q: RawState, U: Into<State<Q>>,

Source§

fn __private__(&self) -> Seal

Source§

fn into_state(self) -> State<Q>

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> Wrapper<T> for T

Source§

type Cont<U> = U

Source§

fn get(&self) -> &T

returns a reference to the inner value
Source§

fn view(&self) -> <T as Wrapper<T>>::Cont<&T>

returns a view of the container containing an immutable reference to the inner value