TuringStates

Trait TuringStates 

Source
pub trait TuringStates<Alphabet: Clone>: Sized + PartialEq {
    // Required method
    fn step(&self, current_token: Alphabet) -> (Self, Alphabet, Move);

    // Provided methods
    fn internal_step(&mut self, tape: &TuringTape<Alphabet>) { ... }
    fn run_until_end(
        start_state: Self,
        end_states: Vec<Self>,
        empty_token: Alphabet,
        start_token: Alphabet,
        initial_state: Vec<Alphabet>,
    ) -> (Self, Vec<Alphabet>) { ... }
}
Expand description

A trait that implements the behaviour for turing states

Required Methods§

Source

fn step(&self, current_token: Alphabet) -> (Self, Alphabet, Move)

The internal step function Output the new state, token at current cursor position, and move of the cursor position

Provided Methods§

Source

fn internal_step(&mut self, tape: &TuringTape<Alphabet>)

Execute one step of the turing machine

Source

fn run_until_end( start_state: Self, end_states: Vec<Self>, empty_token: Alphabet, start_token: Alphabet, initial_state: Vec<Alphabet>, ) -> (Self, Vec<Alphabet>)

Run this turing machine from a start state, until it eaches a final state. Will return a tuple containing the end_state and a vector of the memory state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§