[−][src]Struct peepmatic_automata::Automaton
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:
-
get
-- a high-level method to get the associated output value of a full input sequence. -
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]
TAlphabet: Clone + Eq + Hash + Ord,
TState: Clone + Eq + Hash,
TOutput: Output,
pub fn write_dot_file(
&self,
formatter: &impl DotFmt<TAlphabet, TState, TOutput>,
path: impl AsRef<Path>
) -> Result<()>
[src]
&self,
formatter: &impl DotFmt<TAlphabet, TState, TOutput>,
path: impl AsRef<Path>
) -> Result<()>
Write this Automaton
out as a GraphViz
Dot file at the
given path.
The formatter
parameter controls how TAlphabet
, TState
, and
TOutput
are rendered. See the DotFmt
trait for
details.
This method only exists when the "dot"
cargo feature is enabled.
pub fn write_dot(
&self,
formatter: &impl DotFmt<TAlphabet, TState, TOutput>,
w: &mut impl Write
) -> Result<()>
[src]
&self,
formatter: &impl DotFmt<TAlphabet, TState, TOutput>,
w: &mut impl Write
) -> Result<()>
Write this Automaton
out to the given write-able as a GraphViz
Dot file.
The formatter
parameter controls how TAlphabet
, TState
, and
TOutput
are rendered. See the DotFmt
trait for
details.
This method only exists when the "dot"
cargo feature is enabled.
impl<TAlphabet, TState, TOutput> Automaton<TAlphabet, TState, TOutput> where
TAlphabet: Clone + Eq + Hash + Ord,
TState: Clone + Eq + Hash,
TOutput: Output,
[src]
TAlphabet: Clone + Eq + Hash + Ord,
TState: Clone + Eq + Hash,
TOutput: Output,
pub fn get<'a>(
&self,
input: impl IntoIterator<Item = &'a TAlphabet>
) -> Option<TOutput> where
TAlphabet: 'a,
[src]
&self,
input: impl IntoIterator<Item = &'a TAlphabet>
) -> Option<TOutput> where
TAlphabet: 'a,
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]
TAlphabet: Clone + Eq + Hash + Ord,
TState: Clone + Eq + Hash,
TOutput: Output,
fn clone(&self) -> Automaton<TAlphabet, TState, TOutput>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
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]
TAlphabet: Clone + Eq + Hash + Ord,
TState: Clone + Eq + Hash,
TOutput: Output,
impl<'de, TAlphabet, TState, TOutput> Deserialize<'de> for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: 'de + Deserialize<'de> + Clone + Eq + Hash + Ord,
TState: 'de + Deserialize<'de> + Clone + Eq + Hash,
TOutput: 'de + Deserialize<'de> + Output,
[src]
TAlphabet: 'de + Deserialize<'de> + Clone + Eq + Hash + Ord,
TState: 'de + Deserialize<'de> + Clone + Eq + Hash,
TOutput: 'de + Deserialize<'de> + Output,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<TAlphabet, TState, TOutput> Serialize for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: Serialize + Clone + Eq + Hash + Ord,
TState: Serialize + Clone + Eq + Hash,
TOutput: Serialize + Output,
[src]
TAlphabet: Serialize + Clone + Eq + Hash + Ord,
TState: Serialize + Clone + Eq + Hash,
TOutput: Serialize + Output,
Auto Trait Implementations
impl<TAlphabet, TState, TOutput> RefUnwindSafe for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: RefUnwindSafe,
TOutput: RefUnwindSafe,
TState: RefUnwindSafe,
TAlphabet: RefUnwindSafe,
TOutput: RefUnwindSafe,
TState: RefUnwindSafe,
impl<TAlphabet, TState, TOutput> Send for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: Send,
TOutput: Send,
TState: Send,
TAlphabet: Send,
TOutput: Send,
TState: Send,
impl<TAlphabet, TState, TOutput> Sync for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: Sync,
TOutput: Sync,
TState: Sync,
TAlphabet: Sync,
TOutput: Sync,
TState: Sync,
impl<TAlphabet, TState, TOutput> Unpin for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: Unpin,
TOutput: Unpin,
TState: Unpin,
TAlphabet: Unpin,
TOutput: Unpin,
TState: Unpin,
impl<TAlphabet, TState, TOutput> UnwindSafe for Automaton<TAlphabet, TState, TOutput> where
TAlphabet: RefUnwindSafe + UnwindSafe,
TOutput: RefUnwindSafe + UnwindSafe,
TState: UnwindSafe,
TAlphabet: RefUnwindSafe + UnwindSafe,
TOutput: RefUnwindSafe + UnwindSafe,
TState: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,