[−][src]Struct nifty::dfa::DFABuilder
A builder for the DFA
struct.
Methods
impl<'a, S, T> DFABuilder<S, T> where
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
[src]
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
pub fn recognizes(self, description: &str) -> Self
[src]
Adds a description of the language that this DFA will recognize.
pub fn add_state(self, state: &S) -> Self
[src]
Adds a state to the DFA
.
- Panics if a state is added after any transition has been added. Must add all states before transitions.
pub fn mark_accept_state(self, state: &S) -> Self
[src]
Marks a state as an accept state.
- Panics if the provided state does not exist in this DFA.
pub fn mark_goal_state(self, state: &S) -> Self
[src]
Marks a state as a goal state.
- This will automatically add the goal state to the list of accept states.
- Panics if the provided state does not exist in this DFA.
pub fn mark_dead_state(self, state: &S) -> Self
[src]
Marks a state as a dead state.
- Panics if the provided state does not exist in this DFA.
pub fn mark_start_state(self, state: &S) -> Self
[src]
Marks a state as the start state.
pub fn add_transition(self, from: &S, transition: &T, to: &S) -> Self
[src]
Adds a transition from one state to another.
- Panics if the transition is coming from a dead state. A dead state's transitions cannot be overwritten.
- Panics if the transition is coming from a goal state. A goal state's transitions cannot be overwritten.
- Panics if the from state does not exist in the DFA.
- Panics if the to state does not exist in the DFA.
pub fn build(self) -> DFA<S, T>
[src]
Trait Implementations
impl<S: Default, T: Default> Default for DFABuilder<S, T> where
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
[src]
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
fn default() -> DFABuilder<S, T>
[src]
impl<S: Debug, T: Debug> Debug for DFABuilder<S, T> where
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
[src]
S: Eq + Hash + Clone + Debug,
T: Eq + Hash + Clone + Debug,
Auto Trait Implementations
impl<S, T> !Send for DFABuilder<S, T>
impl<S, T> !Sync for DFABuilder<S, T>
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, 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,