Skip to main content

Halt

Enum Halt 

Source
#[repr(C)]
pub enum Halt<Q = usize, H = Q>
where Q: RawState, H: RawState,
{ Halt(H), Step(Q), }
Expand description

The Halt implementation is a binary enum designed to represent either a halting state or a stepping state within a Turing machine or similar computational model.

Variants§

§

Halt(H)

§

Step(Q)

Implementations§

Source§

impl<Q, H> Halt<Q, H>
where Q: RawState, H: RawState,

Source

pub const fn is_halt(&self) -> bool

Returns true if the enum is Halt::Halt otherwise false

Source

pub const fn is_step(&self) -> bool

Returns true if the enum is Halt::Step otherwise false

Source§

impl<Q, H> Halt<Q, H>
where Q: RawState, H: RawState,

Source

pub const fn from_halt(state: H) -> Halt<Q, H>

Creates a new instance of a Halt with a halted state.

Source

pub const fn from_state(state: Q) -> Halt<Q, H>

Creates a new instance of a Halt with a continuing state.

Source

pub const fn swap(&mut self, other: &mut Halt<Q, H>)

swap the inner value of the halt state with that of the given state.

Source

pub const fn view(&self) -> Halt<&Q, &H>

returns a new instance of the halt state containing a reference to its inner value.

Source

pub const fn view_mut(&mut self) -> Halt<&mut Q, &mut H>

returns a new instance of the halt state containing a mutable reference to its inner value.

Source

pub fn to_owned(&self) -> Halt<Q, H>
where Q: Clone, H: Clone,

returns an owned version of the current haltable state

Source§

impl<Q> Halt<Q>
where Q: RawState,

Source

pub fn into_inner(self) -> Q

consumes the current haltable state, returning the inner state.

Source

pub fn halt(self) -> Halt<Q>

consumes the current instance to ensure a halting state

Source

pub fn into_state(self) -> State<Q>

consumes the current haltable state, returning the inner state.

Source

pub fn into_halt_state(self) -> State<Halt<Q>>

consumes the current instance to initialize a wrapper instance

Source

pub const fn as_halt_state(&self) -> State<Halt<&Q>>

returns a wrapped instance of the halt state containing a reference to its inner value.

Source

pub const fn as_mut_halt_state(&mut self) -> State<Halt<&mut Q>>

returns a wrapped instance of the halt state containing a mutable reference to its inner value.

Source

pub const fn as_state(&self) -> State<&Q>

returns a wrapped reference to the inner value

Source

pub const fn as_mut_state(&mut self) -> State<&mut Q>

returns a wrapped mutable reference to the inner value

Source

pub const fn get(&self) -> &Q

returns a reference to the internal state

Source

pub const fn get_mut(&mut self) -> &mut Q

returns a mutable reference to the internal state

Source

pub const fn replace(&mut self, state: Q) -> Q

replace the inner value of the halt state with the given state.

Source

pub fn set(&mut self, state: Q)

update the current inner state without affecting the status of the state.

Source§

impl<'a, Q, H> Halt<&'a Q, &'a H>
where Q: RawState, H: RawState,

Source

pub fn cloned(self) -> Halt<Q, H>
where Q: Clone, H: Clone,

consumes the current instance of the halt state to create another with cloned inner values.

Source

pub fn copied(self) -> Halt<Q, H>
where Q: Copy, H: Copy,

consumes the current instance of the halt state to create another with copied inner values.

Note: This method does not mutate the specified variant.

Source§

impl<'a, Q, H> Halt<&'a mut Q, &'a mut H>
where Q: RawState, H: RawState,

Source

pub fn cloned(self) -> Halt<Q, H>
where Q: Clone, H: Clone,

consumes the current instance of the halt state to create another with cloned inner values.

Source

pub fn copied(self) -> Halt<Q, H>
where Q: Copy, H: Copy,

consumes the current instance of the halt state to create another with copied inner values.

Trait Implementations§

Source§

impl<Q> AsMut<Q> for Halt<Q>
where Q: RawState,

Source§

fn as_mut(&mut self) -> &mut Q

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<Q> AsRef<Q> for Halt<Q>
where Q: RawState,

Source§

fn as_ref(&self) -> &Q

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Q, H> Clone for Halt<Q, H>
where Q: Clone + RawState, H: Clone + RawState,

Source§

fn clone(&self) -> Halt<Q, H>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Q, H> Debug for Halt<Q, H>
where Q: Debug + RawState, H: Debug + RawState,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<Q> Default for Halt<Q>
where Q: Default + RawState,

Source§

fn default() -> Halt<Q>

Returns the “default value” for a type. Read more
Source§

impl<Q> Deref for Halt<Q>
where Q: RawState,

Source§

type Target = Q

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Halt<Q> as Deref>::Target

Dereferences the value.
Source§

impl<Q> DerefMut for Halt<Q>
where Q: RawState,

Source§

fn deref_mut(&mut self) -> &mut <Halt<Q> as Deref>::Target

Mutably dereferences the value.
Source§

impl<Q, H> EnumCount for Halt<Q, H>
where Q: RawState, H: RawState,

Source§

const COUNT: usize = 2usize

Source§

impl<Q> From<State<Q>> for Halt<Q>
where Q: RawState,

Source§

fn from(_: State<Q>) -> Halt<Q>

Converts to this type from the input type.
Source§

impl<Q, H> Halting for Halt<Q, H>
where Q: RawState, H: RawState,

Source§

fn is_halted(&self) -> bool

returns true if the current state is considered to be halted, otherwise false.
Source§

impl<Q, H> Hash for Halt<Q, H>
where Q: Hash + RawState, H: Hash + RawState,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Q, H> Ord for Halt<Q, H>
where Q: Ord + RawState, H: Ord + RawState,

Source§

fn cmp(&self, other: &Halt<Q, H>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Q, H> PartialEq for Halt<Q, H>

Source§

fn eq(&self, other: &Halt<Q, H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Q, H> PartialOrd for Halt<Q, H>

Source§

fn partial_cmp(&self, other: &Halt<Q, H>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Q, H> Copy for Halt<Q, H>
where Q: Copy + RawState, H: Copy + RawState,

Source§

impl<Q, H> Eq for Halt<Q, H>
where Q: Eq + RawState, H: Eq + RawState,

Source§

impl<Q, H> RawState for Halt<Q, H>
where Q: RawState, H: RawState,

Source§

impl<Q, H> StructuralPartialEq for Halt<Q, H>
where Q: RawState, H: RawState,

Auto Trait Implementations§

§

impl<Q, H> Freeze for Halt<Q, H>
where H: Freeze, Q: Freeze,

§

impl<Q, H> RefUnwindSafe for Halt<Q, H>

§

impl<Q, H> Send for Halt<Q, H>
where H: Send, Q: Send,

§

impl<Q, H> Sync for Halt<Q, H>
where H: Sync, Q: Sync,

§

impl<Q, H> Unpin for Halt<Q, H>
where H: Unpin, Q: Unpin,

§

impl<Q, H> UnwindSafe for Halt<Q, H>
where H: UnwindSafe, Q: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HaltingState for T
where T: RawState + Halting,

Source§

fn __private__(&self) -> Seal

Source§

impl<T> HashState for T
where T: RawState + Eq + Hash,

Source§

fn __private__(&self) -> Seal

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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