Struct peepmatic_automata::Automaton[][src]

pub struct Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Clone + Eq + Hash + Ord,
    TState: Clone + Eq + Hash,
    TOutput: Output
{ /* fields omitted */ }
Expand description

A finite-state transducer automata.

These are constructed via Builder.

An Automaton is immutable: new entries cannot be inserted and existing entries cannot be removed.

To query an Automaton, there are two APIs:

  1. get – a high-level method to get the associated output value of a full input sequence.

  2. query – a low-level method to incrementally query the automata. It does not require that you have the full input sequence on hand all at once, only the next character. It also allows you to process the output as it it built up, rather than only at giving you the final, complete output value.

Implementations

impl<TAlphabet, TState, TOutput> Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Clone + Eq + Hash + Ord,
    TState: Clone + Eq + Hash,
    TOutput: Output
[src]

pub fn get<'a>(
    &self,
    input: impl IntoIterator<Item = &'a TAlphabet>
) -> Option<TOutput> where
    TAlphabet: 'a, 
[src]

Get the output value associated with the given input sequence.

Returns None if the input sequence is not a member of this Automaton’s keys. Otherwise, returns Some(output).

pub fn query(&self) -> Query<'_, TAlphabet, TState, TOutput>[src]

Create a low-level query.

This allows you to incrementally query this Automaton, without providing the full input sequence ahead of time, and also incrementally build up the output.

See Query for details.

Trait Implementations

impl<TAlphabet: Clone, TState: Clone, TOutput: Clone> Clone for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Clone + Eq + Hash + Ord,
    TState: Clone + Eq + Hash,
    TOutput: Output
[src]

fn clone(&self) -> Automaton<TAlphabet, TState, TOutput>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<TAlphabet: Debug, TState: Debug, TOutput: Debug> Debug for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Clone + Eq + Hash + Ord,
    TState: Clone + Eq + Hash,
    TOutput: Output
[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<TAlphabet, TState, TOutput> RefUnwindSafe for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: RefUnwindSafe,
    TOutput: RefUnwindSafe,
    TState: RefUnwindSafe

impl<TAlphabet, TState, TOutput> Send for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Send,
    TOutput: Send,
    TState: Send

impl<TAlphabet, TState, TOutput> Sync for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: Sync,
    TOutput: Sync,
    TState: Sync

impl<TAlphabet, TState, TOutput> Unpin for Automaton<TAlphabet, TState, TOutput> where
    TState: Unpin

impl<TAlphabet, TState, TOutput> UnwindSafe for Automaton<TAlphabet, TState, TOutput> where
    TAlphabet: RefUnwindSafe,
    TOutput: RefUnwindSafe,
    TState: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.