pub struct Instruction<T: Debug> {
pub op_code: usize,
pub name: String,
pub arity: usize,
pub fun: InstructionFn<T>,
}
Expand description
Describes a single instruction which can be used to execute programs.
Contains:
- An op code - a unique integer to identify this instruction.
- A name for serialisation and debugging reasons.
- An arity - the number of arguments this instruction expects to receive.
- A function which is used to execute the instruction.
Fields§
§op_code: usize
§name: String
§arity: usize
§fun: InstructionFn<T>
Implementations§
Source§impl<T: Debug> Instruction<T>
impl<T: Debug> Instruction<T>
Sourcepub fn new(
op_code: usize,
name: &str,
arity: usize,
fun: InstructionFn<T>,
) -> Instruction<T>
pub fn new( op_code: usize, name: &str, arity: usize, fun: InstructionFn<T>, ) -> Instruction<T>
Create a new instruction.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Instruction<T>
impl<T> RefUnwindSafe for Instruction<T>
impl<T> Send for Instruction<T>
impl<T> Sync for Instruction<T>
impl<T> Unpin for Instruction<T>
impl<T> UnwindSafe for Instruction<T>
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