pub struct ProgramBase<R, Q, A, I = <R as RawRuleset<Q, A>>::Rule>{ /* private fields */ }Expand description
The ProgramBase struct is used to define a generic program capable of being executed by
a Turing machine or similar computational model. It consists of an optional initial state,
a set of rules (or instructions) used to indicate how the machine should respond under
different circumstances, and a marker to associate the generic parameters with the struct.
Implementations§
Source§impl<R, I, Q, A> ProgramBase<R, Q, A, I>
impl<R, I, Q, A> ProgramBase<R, Q, A, I>
Sourcepub const fn from_rules(rules: R) -> Self
pub const fn from_rules(rules: R) -> Self
initialize a new program from the given rule set
Sourcepub fn initial_state(&self) -> Option<&State<Q>>
pub fn initial_state(&self) -> Option<&State<Q>>
returns reference to the (optional) initial state
Sourcepub fn set_initial_state(&mut self, initial_state: Q)
pub fn set_initial_state(&mut self, initial_state: Q)
configure the initial state
Sourcepub fn with_default_state<U>(self, initial_state: U) -> Selfwhere
U: IntoState<Q>,
pub fn with_default_state<U>(self, initial_state: U) -> Selfwhere
U: IntoState<Q>,
consumes the instance to create another with the given initial state
pub fn get_head(&self, head: &Head<Q, A>) -> Option<&Tail<Q, A>>
Source§impl<I, Q, A> ProgramBase<[I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
impl<I, Q, A> ProgramBase<[I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
Source§impl<I, Q, A> ProgramBase<&[I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
impl<I, Q, A> ProgramBase<&[I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
Source§impl<I, Q, A> ProgramBase<&mut [I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
impl<I, Q, A> ProgramBase<&mut [I], Q, A, I>where
Q: RawState,
I: Instruction<Q, A>,
Source§impl<const N: usize, I, Q, A> ProgramBase<[I; N], Q, A>where
Q: RawState,
I: Instruction<Q, A>,
impl<const N: usize, I, Q, A> ProgramBase<[I; N], Q, A>where
Q: RawState,
I: Instruction<Q, A>,
Trait Implementations§
Source§impl<R, Q, A: Clone, I> Clone for ProgramBase<R, Q, A, I>where
Q: RawState + Clone,
R: RawRuleset<Q, A, Rule = I> + Clone + ?Sized,
I: Instruction<Q, A> + Clone,
impl<R, Q, A: Clone, I> Clone for ProgramBase<R, Q, A, I>where
Q: RawState + Clone,
R: RawRuleset<Q, A, Rule = I> + Clone + ?Sized,
I: Instruction<Q, A> + Clone,
Source§fn clone(&self) -> ProgramBase<R, Q, A, I>
fn clone(&self) -> ProgramBase<R, Q, A, I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<R, I, Q, A> Debug for ProgramBase<R, Q, A, I>
impl<R, I, Q, A> Debug for ProgramBase<R, Q, A, I>
Source§impl<R, Q, A: Default, I> Default for ProgramBase<R, Q, A, I>where
Q: RawState + Default,
R: RawRuleset<Q, A, Rule = I> + Default + ?Sized,
I: Instruction<Q, A> + Default,
impl<R, Q, A: Default, I> Default for ProgramBase<R, Q, A, I>where
Q: RawState + Default,
R: RawRuleset<Q, A, Rule = I> + Default + ?Sized,
I: Instruction<Q, A> + Default,
Source§fn default() -> ProgramBase<R, Q, A, I>
fn default() -> ProgramBase<R, Q, A, I>
Returns the “default value” for a type. Read more
Source§impl<R, I, Q, A> Display for ProgramBase<R, Q, A, I>where
R: RawRuleset<Q, A, Rule = I> + Debug,
Q: RawState + Display,
I: Instruction<Q, A> + Debug + Display,
impl<R, I, Q, A> Display for ProgramBase<R, Q, A, I>where
R: RawRuleset<Q, A, Rule = I> + Debug,
Q: RawState + Display,
I: Instruction<Q, A> + Debug + Display,
Source§impl<X, R, Q, A> Extend<X> for ProgramBase<R, Q, A, X>
impl<X, R, Q, A> Extend<X> for ProgramBase<R, Q, A, X>
Source§fn extend<Iter>(&mut self, iter: Iter)where
Iter: IntoIterator<Item = X>,
fn extend<Iter>(&mut self, iter: Iter)where
Iter: IntoIterator<Item = X>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<X, R, Q, A> FromIterator<X> for ProgramBase<R, Q, A, X>
impl<X, R, Q, A> FromIterator<X> for ProgramBase<R, Q, A, X>
Source§fn from_iter<Iter>(iter: Iter) -> Selfwhere
Iter: IntoIterator<Item = X>,
fn from_iter<Iter>(iter: Iter) -> Selfwhere
Iter: IntoIterator<Item = X>,
Creates a value from an iterator. Read more
Source§impl<R, Q, A: Hash, I> Hash for ProgramBase<R, Q, A, I>where
Q: RawState + Hash,
R: RawRuleset<Q, A, Rule = I> + Hash + ?Sized,
I: Instruction<Q, A> + Hash,
impl<R, Q, A: Hash, I> Hash for ProgramBase<R, Q, A, I>where
Q: RawState + Hash,
R: RawRuleset<Q, A, Rule = I> + Hash + ?Sized,
I: Instruction<Q, A> + Hash,
Source§impl<'a, X, I, R, Q, A> IntoIterator for &'a ProgramBase<R, Q, A, X>where
Q: RawState,
X: 'a + Instruction<Q, A>,
R: RawRuleset<Q, A, Rule = X>,
I: Iterator<Item = &'a X>,
for<'b> &'b R: IntoIterator<Item = &'b X, IntoIter = I>,
impl<'a, X, I, R, Q, A> IntoIterator for &'a ProgramBase<R, Q, A, X>where
Q: RawState,
X: 'a + Instruction<Q, A>,
R: RawRuleset<Q, A, Rule = X>,
I: Iterator<Item = &'a X>,
for<'b> &'b R: IntoIterator<Item = &'b X, IntoIter = I>,
Source§impl<I, X, R, Q, A> IntoIterator for ProgramBase<R, Q, A, X>where
I: Iterator<Item = X>,
Q: RawState,
X: Instruction<Q, A>,
R: RawRuleset<Q, A, Rule = X> + IntoIterator<Item = X, IntoIter = I>,
impl<I, X, R, Q, A> IntoIterator for ProgramBase<R, Q, A, X>where
I: Iterator<Item = X>,
Q: RawState,
X: Instruction<Q, A>,
R: RawRuleset<Q, A, Rule = X> + IntoIterator<Item = X, IntoIter = I>,
Source§impl<R, Q, A: Ord, I> Ord for ProgramBase<R, Q, A, I>
impl<R, Q, A: Ord, I> Ord for ProgramBase<R, Q, A, I>
Source§fn cmp(&self, other: &ProgramBase<R, Q, A, I>) -> Ordering
fn cmp(&self, other: &ProgramBase<R, Q, A, I>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<R, Q, A: PartialEq, I> PartialEq for ProgramBase<R, Q, A, I>where
Q: RawState + PartialEq,
R: RawRuleset<Q, A, Rule = I> + PartialEq + ?Sized,
I: Instruction<Q, A> + PartialEq,
impl<R, Q, A: PartialEq, I> PartialEq for ProgramBase<R, Q, A, I>where
Q: RawState + PartialEq,
R: RawRuleset<Q, A, Rule = I> + PartialEq + ?Sized,
I: Instruction<Q, A> + PartialEq,
Source§impl<R, Q, A: PartialOrd, I> PartialOrd for ProgramBase<R, Q, A, I>where
Q: RawState + PartialOrd,
R: RawRuleset<Q, A, Rule = I> + PartialOrd + ?Sized,
I: Instruction<Q, A> + PartialOrd,
impl<R, Q, A: PartialOrd, I> PartialOrd for ProgramBase<R, Q, A, I>where
Q: RawState + PartialOrd,
R: RawRuleset<Q, A, Rule = I> + PartialOrd + ?Sized,
I: Instruction<Q, A> + PartialOrd,
impl<R, Q, A: Copy, I> Copy for ProgramBase<R, Q, A, I>where
Q: RawState + Copy,
R: RawRuleset<Q, A, Rule = I> + Copy + ?Sized,
I: Instruction<Q, A> + Copy,
impl<R, Q, A: Eq, I> Eq for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> StructuralPartialEq for ProgramBase<R, Q, A, I>
Auto Trait Implementations§
impl<R, Q, A, I> Freeze for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> RefUnwindSafe for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> Send for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> Sync for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> Unpin for ProgramBase<R, Q, A, I>
impl<R, Q, A, I> UnwindSafe for ProgramBase<R, Q, A, I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more