ComputationalEngine

Trait ComputationalEngine 

Source
pub trait ComputationalEngine<Q, S>: RawEngine + Sized
where Q: RawState, S: Alphabet, Self::Store: RawStore<Elem = <S as RawStore>::Elem>,
{
Show 18 methods // Required methods fn new(alphabet: S, initial_state: State<Q>) -> Self; fn alphabet(&self) -> &S; fn alphabet_mut(&mut self) -> &mut S; fn head(&self) -> Head<&Q, &<S as RawStore>::Elem>; fn head_mut(&mut self) -> Head<&mut Q, &mut <S as RawStore>::Elem>; fn position(&self) -> usize; fn position_mut(&mut self) -> &mut usize; fn state(&self) -> State<&Q>; fn state_mut(&mut self) -> State<&mut Q>; fn tape(&self) -> &Self::Store; fn tape_mut(&mut self) -> &mut Self::Store; fn step(&mut self) -> Result<(), ActorError>; fn set_alphabet(&mut self, alphabet: S); fn set_position(&mut self, position: usize); fn set_state(&mut self, state: State<Q>); fn set_tape<I>(&mut self, tape: I) where I: IntoIterator<Item = <S as RawStore>::Elem>; // Provided methods fn restore_from_snapshot( &mut self, snapshot: SnapshotBase<Q, S, Self::Store>, ) where Self::Store: IntoIterator<Item = <S as RawStore>::Elem> { ... } fn snapshot(&self) -> SnapshotBase<&Q, &S, &Self::Store> { ... }
}
Expand description

A compute-oriented engine abstracted for use within the Plant.

Required Methods§

Source

fn new(alphabet: S, initial_state: State<Q>) -> Self

Source

fn alphabet(&self) -> &S

returns an immutable reference to the alphabet

Source

fn alphabet_mut(&mut self) -> &mut S

returns a mutable reference to the alphabet

Source

fn head(&self) -> Head<&Q, &<S as RawStore>::Elem>

returns an instance of the head with immutable references to the state and symbol

Source

fn head_mut(&mut self) -> Head<&mut Q, &mut <S as RawStore>::Elem>

returns an instance of the head with mutable references to the state and symbol

Source

fn position(&self) -> usize

returns a copy of the machine’s current position

Source

fn position_mut(&mut self) -> &mut usize

returns a mutable reference to the machine’s current position

Source

fn state(&self) -> State<&Q>

returns an instance of the state with an immutable inner value

Source

fn state_mut(&mut self) -> State<&mut Q>

returns an instance of the state with a mutable inner value

Source

fn tape(&self) -> &Self::Store

returns an immutable reference to the tape

Source

fn tape_mut(&mut self) -> &mut Self::Store

returns a mutable reference to the tape

Source

fn step(&mut self) -> Result<(), ActorError>

preform a single step of the turing machine

Source

fn set_alphabet(&mut self, alphabet: S)

sets the alphabet of the turing machine

Source

fn set_position(&mut self, position: usize)

sets the position of the head

Source

fn set_state(&mut self, state: State<Q>)

sets the state of the head

Source

fn set_tape<I>(&mut self, tape: I)
where I: IntoIterator<Item = <S as RawStore>::Elem>,

sets the tape of the turing machine

Provided Methods§

Source

fn restore_from_snapshot(&mut self, snapshot: SnapshotBase<Q, S, Self::Store>)
where Self::Store: IntoIterator<Item = <S as RawStore>::Elem>,

restores the engine from a snapshot

Source

fn snapshot(&self) -> SnapshotBase<&Q, &S, &Self::Store>

returns a snapshot of the engine

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§