Struct State

Source
pub struct State { /* private fields */ }
Expand description

State of an automaton

Implementations§

Source§

impl State

Source

pub fn id(&self) -> usize

State id

Source

pub fn is_final(&self) -> bool

Check whether a state is final

Source

pub fn num_successors(&self) -> usize

Number of transitions, not including the default

Source

pub fn has_default_successor(&self) -> bool

Check whether a state has a default successor

Source

pub fn default_successor(&self) -> Option<usize>

Get the default successor

Source

pub fn valid_class_id(&self, cid: ClassId) -> bool

Check whether a class id is valid for this state

  • a class id Interval(i) is valid if i < number of transitions
  • class id Complement is valid if there’s a default successor defined
Source

pub fn char_maps_to_default(&self, c: u32) -> bool

Check whether character c maps to the default successor

Source

pub fn char_classes(&self) -> ClassIdIterator<'_>

Iterate through all valid class ids for this state

Source

pub fn class_of_char(&self, x: u32) -> ClassId

Return the class id for a character

Source

pub fn char_picks(&self) -> PickIterator<'_>

Pick a character in each class of this state’s character partition

Source

pub fn char_ranges(&self) -> impl Iterator<Item = &CharSet>

Iterate through the character ranges defined for this state.

Same as char_classes, except that the complementary class is not included.

Trait Implementations§

Source§

impl Debug for State

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for State

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

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<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.