Skip to main content

HeadStep

Struct HeadStep 

Source
pub struct HeadStep<'a, Q1, A1, Q2 = Q1, A2 = A1>
where Q1: RawState, Q2: RawState,
{ /* private fields */ }
Expand description

HeadStep defines a lazy stepper for a Turing machine configured with a so-called moving head.

Implementations§

Source§

impl<'a, Q, A> HeadStep<'a, Q, A>
where Q: RawState,

the standard implementation of HeadStep focuses on instances where the head and tail share the same type-space; meaning Head<Q, A> and Tail<Q, A> types are being utilized.

Source

pub fn apply(self) -> Head<Q, A>

apply the step, mutating the head according to the tail’s instructions before returning the previous head value.

Source

pub fn move_along(self, tape: &mut [A], pos: &mut usize) -> Head<Q, A>
where A: Clone,

this method performs the step operation onto the tape, assuming the head’s symbol to be

Source§

impl<'a, Q, A> HeadStep<'a, Q, usize, Q, A>
where Q: RawState,

this implementation of the HeadStep is specifically designed for scenarios where the head’s symbol is used to define the position

Source

pub fn shift(self, tape: &mut [A]) -> Result<Head<Q, A>>
where A: Clone,

this method shifts the head along the tape, returning a head containing the previous state and symbol.

note: this method does not check if the current nor the next state is halted, it is up to the caller to establishing halting.

Auto Trait Implementations§

§

impl<'a, Q1, A1, Q2, A2> Freeze for HeadStep<'a, Q1, A1, Q2, A2>
where A2: Freeze, Q2: Freeze,

§

impl<'a, Q1, A1, Q2, A2> RefUnwindSafe for HeadStep<'a, Q1, A1, Q2, A2>

§

impl<'a, Q1, A1, Q2, A2> Send for HeadStep<'a, Q1, A1, Q2, A2>
where A2: Send, A1: Send, Q2: Send, Q1: Send,

§

impl<'a, Q1, A1, Q2, A2> Sync for HeadStep<'a, Q1, A1, Q2, A2>
where A2: Sync, A1: Sync, Q2: Sync, Q1: Sync,

§

impl<'a, Q1, A1, Q2, A2> Unpin for HeadStep<'a, Q1, A1, Q2, A2>
where A2: Unpin, Q2: Unpin,

§

impl<'a, Q1, A1, Q2 = Q1, A2 = A1> !UnwindSafe for HeadStep<'a, Q1, A1, Q2, A2>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Q, A, T> IntoHead<Q, A> for T
where T: Into<Head<Q, A>>,

Source§

fn into_head(self) -> Head<Q, A>

Source§

impl<U, Q> IntoState<Q> for U
where Q: RawState, U: Into<State<Q>>,

Source§

fn __private__(&self) -> Seal

Source§

fn into_state(self) -> State<Q>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Wrapper<T> for T

Source§

type Cont<U> = U

Source§

fn get(&self) -> &T

returns a reference to the inner value
Source§

fn view(&self) -> <T as Wrapper<T>>::Cont<&T>

returns a view of the container containing an immutable reference to the inner value