Struct turingmachine_rs::TuringTape[][src]

pub struct TuringTape<Alphabet> { /* fields omitted */ }

A possibly theorically infinite TuringTape

Implementations

impl<Alphabet: Clone> TuringTape<Alphabet>[src]

pub fn new(
    empty: Alphabet,
    start: Alphabet,
    initial: Vec<Alphabet>
) -> TuringTape<Alphabet>
[src]

Initialize a new TuringTape with:

  • empty: The token put at empty tape cells
  • start: The token put in the first cell
  • initial: An vector of tokens to be put after the start token

pub fn get_cursor(&self) -> Alphabet[src]

Fetch the token at the cursor

pub fn set_cursor(&self, value: Alphabet) -> Alphabet[src]

Set the token at the cursor and return the old token

pub fn step_right(&self) -> Alphabet[src]

Make the cursor go one cell to the right

pub fn step_left(&self) -> Alphabet[src]

Make the cursor go one cell to the left

Will panic if one goes off the tape.

pub fn run_states<S: TuringStates<Alphabet> + PartialEq>(
    &self,
    start_state: S,
    end_states: Vec<S>
) -> S
[src]

Runs from start state until one of the end states has been reached. Will return the end state.

Trait Implementations

impl<Alphabet: Display + Clone> Display for TuringTape<Alphabet>[src]

Auto Trait Implementations

impl<Alphabet> !RefUnwindSafe for TuringTape<Alphabet>

impl<Alphabet> !Send for TuringTape<Alphabet>

impl<Alphabet> !Sync for TuringTape<Alphabet>

impl<Alphabet> Unpin for TuringTape<Alphabet> where
    Alphabet: Unpin

impl<Alphabet> !UnwindSafe for TuringTape<Alphabet>

Blanket Implementations

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

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

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

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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.