pub struct Dfa<'a, Σ: Eq + Hash + Copy, S: State<Σ>> { /* private fields */ }Expand description
Provides an API for construction and simulation of a DFA structure. Symbol type Σ must be hashable and implement display (not asking for alot here..)
Implementations§
Source§impl<'a, Σ: Eq + Hash + Copy> Dfa<'a, Σ, PartialState<Σ>>
impl<'a, Σ: Eq + Hash + Copy> Dfa<'a, Σ, PartialState<Σ>>
Sourcepub fn new(start_node: &'a PartialState<Σ>) -> Self
pub fn new(start_node: &'a PartialState<Σ>) -> Self
Creates a new DFA with no vertices, but an Arena ready for pushing verts.
Sourcepub fn simulate_slice(&self, input: &[Σ]) -> bool
pub fn simulate_slice(&self, input: &[Σ]) -> bool
Tests the provided input sequence, returning true if the DFA ends at an accept state.
Sourcepub fn simulate_iter(&self, input: impl Iterator<Item = Σ>) -> bool
pub fn simulate_iter(&self, input: impl Iterator<Item = Σ>) -> bool
Tests the provided input sequence on an iterator, returning true if the DFA ends at an accept state.
Source§impl<'a, Σ: Eq + Hash + Copy + Indexable> Dfa<'a, Σ, CompleteState<Σ>>
impl<'a, Σ: Eq + Hash + Copy + Indexable> Dfa<'a, Σ, CompleteState<Σ>>
Sourcepub fn new(start_node: &'a CompleteState<Σ>) -> Self
pub fn new(start_node: &'a CompleteState<Σ>) -> Self
Creates a new DFA with no vertices, but an Arena ready for pushing verts.
Sourcepub fn simulate_iter(&self, input: impl Iterator<Item = Σ>) -> bool
pub fn simulate_iter(&self, input: impl Iterator<Item = Σ>) -> bool
Tests the provided input sequence, returning true if the DFA ends at an accept state.
Sourcepub fn simulate_slice(&self, input: &[Σ]) -> bool
pub fn simulate_slice(&self, input: &[Σ]) -> bool
Tests the provided input sequence, returning true if the DFA ends at an accept state.
Auto Trait Implementations§
impl<'a, Σ, S> Freeze for Dfa<'a, Σ, S>
impl<'a, Σ, S> RefUnwindSafe for Dfa<'a, Σ, S>where
S: RefUnwindSafe,
Σ: RefUnwindSafe,
impl<'a, Σ, S> Send for Dfa<'a, Σ, S>
impl<'a, Σ, S> Sync for Dfa<'a, Σ, S>
impl<'a, Σ, S> Unpin for Dfa<'a, Σ, S>where
Σ: Unpin,
impl<'a, Σ, S> UnsafeUnpin for Dfa<'a, Σ, S>
impl<'a, Σ, S> UnwindSafe for Dfa<'a, Σ, S>where
S: RefUnwindSafe,
Σ: 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