pub struct AutomatonBuilder<T> { /* private fields */ }
Expand description
Automaton builder
Implementations§
Source§impl<T: Eq + Hash + Clone> AutomatonBuilder<T>
impl<T: Eq + Hash + Clone> AutomatonBuilder<T>
Sourcepub fn new(initial_state: &T) -> Self
pub fn new(initial_state: &T) -> Self
Create a new builder
- initial_state = initial state for the resulting automaton
Sourcepub fn mark_final(&mut self, state: &T) -> &mut Self
pub fn mark_final(&mut self, state: &T) -> &mut Self
Mark a final state
Sourcepub fn set_default_successor(&mut self, state: &T, next: &T) -> &mut Self
pub fn set_default_successor(&mut self, state: &T, next: &T) -> &mut Self
Set the default successor of a state
Sourcepub fn add_transition(
&mut self,
state: &T,
set: &CharSet,
next: &T,
) -> &mut Self
pub fn add_transition( &mut self, state: &T, set: &CharSet, next: &T, ) -> &mut Self
Add a transition
Sourcepub fn build(&mut self) -> Result<Automaton, Error>
pub fn build(&mut self) -> Result<Automaton, Error>
Construct an automaton
- fails if a state
s
has non-deterministic transitions, i.e., if two distinct transitions from s have non-disjoint labels (i.e., character sets). - fails if a state
s
has a default successor but its transitions already cover the full alphabet. - fails if a state
s
doesn’t have a default successor but its transitions do not cover the full alphabet.
Sourcepub fn build_unchecked(&mut self) -> Automaton
pub fn build_unchecked(&mut self) -> Automaton
Build without checking
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for AutomatonBuilder<T>
impl<T> RefUnwindSafe for AutomatonBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for AutomatonBuilder<T>where
T: Send,
impl<T> Sync for AutomatonBuilder<T>where
T: Sync,
impl<T> Unpin for AutomatonBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for AutomatonBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more