Skip to main content

Machine

Trait Machine 

Source
pub trait Machine {
    type Input;
    type Output;

    // Required methods
    fn step(self, input: Self::Input) -> (Self::Output, Self)
       where Self: Sized;
    fn describe<V>(&self, visitor: &mut V) -> <V as Structure>::Output
       where V: Structure;
}
Expand description

A stateful transducer whose composition remains structurally inspectable.

Required Associated Types§

Source

type Input

Input consumed by one step.

Source

type Output

Output produced for one input.

Required Methods§

Source

fn step(self, input: Self::Input) -> (Self::Output, Self)
where Self: Sized,

Consume one input and return the output plus successor machine.

Source

fn describe<V>(&self, visitor: &mut V) -> <V as Structure>::Output
where V: Structure,

Fold the retained composition tree with a structural interpreter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A, B> Machine for Product<A, B>
where A: Machine, B: Machine,

Source§

type Input = (<A as Machine>::Input, <B as Machine>::Input)

Source§

type Output = (<A as Machine>::Output, <B as Machine>::Output)

Source§

impl<A, B> Machine for Routed<A, B>
where A: Machine, B: Machine,

Source§

type Input = Either<<A as Machine>::Input, <B as Machine>::Input>

Source§

type Output = Either<<A as Machine>::Output, <B as Machine>::Output>

Source§

impl<A, B> Machine for Then<A, B>
where A: Machine, B: Machine<Input = <A as Machine>::Output>,

Source§

impl<S, I, O, F> Machine for Base<S, F, I, O>
where F: FnMut(S, I) -> (O, S),

Source§

type Input = I

Source§

type Output = O