Enum triton_vm::instruction::AnInstruction
source · pub enum AnInstruction<Dest: PartialEq + Default> {
Show 38 variants
Pop(NumberOfWords),
Push(BFieldElement),
Divine(NumberOfWords),
Dup(OpStackElement),
Swap(OpStackElement),
Halt,
Nop,
Skiz,
Call(Dest),
Return,
Recurse,
Assert,
ReadMem(NumberOfWords),
WriteMem(NumberOfWords),
Hash,
DivineSibling,
AssertVector,
SpongeInit,
SpongeAbsorb,
SpongeSqueeze,
Add,
Mul,
Invert,
Eq,
Split,
Lt,
And,
Xor,
Log2Floor,
Pow,
DivMod,
PopCount,
XxAdd,
XxMul,
XInvert,
XbMul,
ReadIo(NumberOfWords),
WriteIo(NumberOfWords),
}Expand description
A Triton VM instruction. See the Instruction Set Architecture for more details.
The type parameter Dest describes the type of addresses (absolute or labels).
Variants§
Pop(NumberOfWords)
Push(BFieldElement)
Divine(NumberOfWords)
Dup(OpStackElement)
Swap(OpStackElement)
Halt
Nop
Skiz
Call(Dest)
Return
Recurse
Assert
ReadMem(NumberOfWords)
WriteMem(NumberOfWords)
Hash
DivineSibling
AssertVector
SpongeInit
SpongeAbsorb
SpongeSqueeze
Add
Mul
Invert
Eq
Split
Lt
And
Xor
Log2Floor
Pow
DivMod
PopCount
XxAdd
XxMul
XInvert
XbMul
ReadIo(NumberOfWords)
WriteIo(NumberOfWords)
Implementations§
source§impl<Dest: PartialEq + Default> AnInstruction<Dest>
impl<Dest: PartialEq + Default> AnInstruction<Dest>
pub fn opcode_b(&self) -> BFieldElement
pub fn size(&self) -> usize
sourcepub fn ib(&self, arg: InstructionBit) -> BFieldElement
pub fn ib(&self, arg: InstructionBit) -> BFieldElement
Get the i’th instruction bit
pub const fn grows_op_stack(&self) -> bool
👎Deprecated since 0.39.0: use
op_stack_size_influence() > 0 insteadpub const fn changes_op_stack_size(&self) -> bool
👎Deprecated since 0.39.0: use
op_stack_size_influence() != 0 insteadpub const fn shrinks_op_stack(&self) -> bool
👎Deprecated since 0.39.0: use
op_stack_size_influence() < 0 insteadpub const fn op_stack_size_influence(&self) -> i32
sourcepub fn is_u32_instruction(&self) -> bool
pub fn is_u32_instruction(&self) -> bool
Indicates whether the instruction operates on base field elements that are also u32s.
pub fn has_illegal_argument(&self) -> bool
source§impl AnInstruction<BFieldElement>
impl AnInstruction<BFieldElement>
sourcepub fn arg(&self) -> Option<BFieldElement>
pub fn arg(&self) -> Option<BFieldElement>
Get the argument of the instruction, if it has one.
sourcepub fn has_arg(&self) -> bool
👎Deprecated since 0.39.0: use arg().is_some() instead
pub fn has_arg(&self) -> bool
arg().is_some() insteadtrue iff the instruction has an argument.
sourcepub fn change_arg(
self,
new_arg: BFieldElement
) -> Result<Self, InstructionError>
pub fn change_arg( self, new_arg: BFieldElement ) -> Result<Self, InstructionError>
Change the argument of the instruction, if it has one. Returns an Err if the instruction
does not have an argument or if the argument is out of range.
Trait Implementations§
source§impl<'arbitrary, Dest: PartialEq + Default + Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for AnInstruction<Dest>
impl<'arbitrary, Dest: PartialEq + Default + Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for AnInstruction<Dest>
source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moresource§impl<Dest: Clone + PartialEq + Default> Clone for AnInstruction<Dest>
impl<Dest: Clone + PartialEq + Default> Clone for AnInstruction<Dest>
source§fn clone(&self) -> AnInstruction<Dest>
fn clone(&self) -> AnInstruction<Dest>
Returns a copy 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<'de, Dest> Deserialize<'de> for AnInstruction<Dest>
impl<'de, Dest> Deserialize<'de> for AnInstruction<Dest>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<Dest: PartialEq + Default + GetSize> GetSize for AnInstruction<Dest>
impl<Dest: PartialEq + Default + GetSize> GetSize for AnInstruction<Dest>
source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
source§impl<Dest: PartialEq + Default> IntoEnumIterator for AnInstruction<Dest>
impl<Dest: PartialEq + Default> IntoEnumIterator for AnInstruction<Dest>
type Iterator = AnInstructionIter<Dest>
fn iter() -> AnInstructionIter<Dest> ⓘ
source§impl<Dest: PartialEq + PartialEq + Default> PartialEq for AnInstruction<Dest>
impl<Dest: PartialEq + PartialEq + Default> PartialEq for AnInstruction<Dest>
source§fn eq(&self, other: &AnInstruction<Dest>) -> bool
fn eq(&self, other: &AnInstruction<Dest>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<Dest> Serialize for AnInstruction<Dest>
impl<Dest> Serialize for AnInstruction<Dest>
impl<Dest: Copy + PartialEq + Default> Copy for AnInstruction<Dest>
impl<Dest: Eq + PartialEq + Default> Eq for AnInstruction<Dest>
impl<Dest: PartialEq + Default> StructuralPartialEq for AnInstruction<Dest>
Auto Trait Implementations§
impl<Dest> Freeze for AnInstruction<Dest>where
Dest: Freeze,
impl<Dest> RefUnwindSafe for AnInstruction<Dest>where
Dest: RefUnwindSafe,
impl<Dest> Send for AnInstruction<Dest>where
Dest: Send,
impl<Dest> Sync for AnInstruction<Dest>where
Dest: Sync,
impl<Dest> Unpin for AnInstruction<Dest>where
Dest: Unpin,
impl<Dest> UnwindSafe for AnInstruction<Dest>where
Dest: UnwindSafe,
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more