pub struct StateId(pub u32);Expand description
Dense integer identifier for an automaton state.
StateId is the fast state representation used by crate::Explicit,
crate::Memo, and deterministic runners. IDs are dense, starting at zero,
so they can be used to index vectors and bitsets.
Most users should create states with crate::ExplicitBuilder::new_state
or crate::Interner::intern rather than constructing StateId directly.
The one special value is StateId::STUCK, which is reserved for rejected
subtrees and must not be used as an ordinary state.
Tuple Fields§
§0: u32Implementations§
Source§impl StateId
impl StateId
Sourcepub const STUCK: StateId
pub const STUCK: StateId
Sentinel meaning “this subtree has no valid state”.
Deterministic runs store this value in their side table when a node is rejected. Builders and interners never allocate it as a real state.
Sourcepub fn index(self) -> usize
pub fn index(self) -> usize
Convert this state ID to a vector or bitset index.
Do not call this on StateId::STUCK unless the surrounding code has
explicitly chosen to handle the sentinel as usize::MAX.
Trait Implementations§
impl Copy for StateId
impl Eq for StateId
Source§impl Ord for StateId
impl Ord for StateId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for StateId
impl PartialOrd for StateId
impl StructuralPartialEq for StateId
Auto Trait Implementations§
impl Freeze for StateId
impl RefUnwindSafe for StateId
impl Send for StateId
impl Sync for StateId
impl Unpin for StateId
impl UnsafeUnpin for StateId
impl UnwindSafe for StateId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.