pub trait ComputationalEngine<Q, S>: RawEngine + Sized{
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§
fn new(alphabet: S, initial_state: State<Q>) -> Self
Sourcefn alphabet_mut(&mut self) -> &mut S
fn alphabet_mut(&mut self) -> &mut S
returns a mutable reference to the alphabet
Sourcefn head(&self) -> Head<&Q, &<S as RawStore>::Elem>
fn head(&self) -> Head<&Q, &<S as RawStore>::Elem>
returns an instance of the head with immutable references to the state and symbol
Sourcefn head_mut(&mut self) -> Head<&mut Q, &mut <S as RawStore>::Elem>
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
Sourcefn position_mut(&mut self) -> &mut usize
fn position_mut(&mut self) -> &mut usize
returns a mutable reference to the machine’s current position
Sourcefn state_mut(&mut self) -> State<&mut Q>
fn state_mut(&mut self) -> State<&mut Q>
returns an instance of the state with a mutable inner value
Sourcefn step(&mut self) -> Result<(), ActorError>
fn step(&mut self) -> Result<(), ActorError>
preform a single step of the turing machine
Sourcefn set_alphabet(&mut self, alphabet: S)
fn set_alphabet(&mut self, alphabet: S)
sets the alphabet of the turing machine
Sourcefn set_position(&mut self, position: usize)
fn set_position(&mut self, position: usize)
sets the position of the head
Provided Methods§
Sourcefn restore_from_snapshot(&mut self, snapshot: SnapshotBase<Q, S, Self::Store>)
fn restore_from_snapshot(&mut self, snapshot: SnapshotBase<Q, S, Self::Store>)
restores the engine from a snapshot
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.