Trait contained_turing::Contract
source · pub trait Contract<S: Symbolic>: Clone + IndexMut<usize, Output = Instruction<S>> + Include<Instruction<S>> + Insert<usize, Instruction<S>> {
// Required methods
fn alphabet(&self) -> Box<dyn Alphabet<S>>;
fn final_state(&self) -> State;
fn instructions(&self) -> &Vec<Instruction<S>>;
fn instructions_mut(&mut self) -> &mut Vec<Instruction<S>>;
// Provided methods
fn get(&self, head: Head<S>) -> Option<&Instruction<S>> { ... }
fn insert(&mut self, inst: Instruction<S>) -> Option<Instruction<S>> { ... }
}Required Methods§
fn alphabet(&self) -> Box<dyn Alphabet<S>>
fn final_state(&self) -> State
fn instructions(&self) -> &Vec<Instruction<S>>
fn instructions_mut(&mut self) -> &mut Vec<Instruction<S>>
Provided Methods§
sourcefn get(&self, head: Head<S>) -> Option<&Instruction<S>>
fn get(&self, head: Head<S>) -> Option<&Instruction<S>>
Given some Head, find the coresponding Instruction
sourcefn insert(&mut self, inst: Instruction<S>) -> Option<Instruction<S>>
fn insert(&mut self, inst: Instruction<S>) -> Option<Instruction<S>>
Try to insert a new Instruction into the program; if the instruction is invalid, return None Otherwise, return the previous instruction at the same Head if it exists