snarkvm_synthesizer_program::logic::instruction

Struct Literals

Source
pub struct Literals<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> { /* private fields */ }

Implementations§

Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Literals<N, O, NUM_OPERANDS>

Source

pub const fn opcode() -> Opcode

Returns the opcode.

Source

pub fn operands(&self) -> &[Operand<N>]

Returns the operands in the operation.

Source

pub fn destinations(&self) -> Vec<Register<N>>

Returns the destination register.

Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Literals<N, O, NUM_OPERANDS>

Source

pub fn evaluate( &self, stack: &(impl StackMatches<N> + StackProgram<N>), registers: &mut (impl RegistersLoad<N> + RegistersStore<N>), ) -> Result<()>

Evaluates the instruction.

Source

pub fn execute<A: Aleo<Network = N>>( &self, stack: &(impl StackMatches<N> + StackProgram<N>), registers: &mut (impl RegistersLoadCircuit<N, A> + RegistersStoreCircuit<N, A>), ) -> Result<()>

Executes the instruction.

Source

pub fn finalize( &self, stack: &(impl StackMatches<N> + StackProgram<N>), registers: &mut (impl RegistersLoad<N> + RegistersStore<N>), ) -> Result<()>

Finalizes the instruction.

Source

pub fn output_types( &self, _stack: &impl StackProgram<N>, input_types: &[RegisterType<N>], ) -> Result<Vec<RegisterType<N>>>

Returns the output type from the given program and input types.

Trait Implementations§

Source§

impl<N: Clone + Network, O: Clone + Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Clone for Literals<N, O, NUM_OPERANDS>

Source§

fn clone(&self) -> Literals<N, O, NUM_OPERANDS>

Returns a copy 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<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Debug for Literals<N, O, NUM_OPERANDS>

Source§

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

Prints the operation as a string.

Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Display for Literals<N, O, NUM_OPERANDS>

Source§

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

Prints the operation to a string.

Source§

impl<N: Network> From<Literals<N, AbsOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Abs<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, AbsWrappedOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: AbsWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, AddOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Add<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, AddWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: AddWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, AndOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: And<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, DivOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Div<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, DivWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: DivWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, DoubleOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Double<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, GreaterThanOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: GreaterThan<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, GreaterThanOrEqualOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: GreaterThanOrEqual<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, InvOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Inv<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, LessThanOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: LessThan<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, LessThanOrEqualOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: LessThanOrEqual<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, ModuloOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Modulo<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, MulOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Mul<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, MulWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: MulWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, NandOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Nand<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, NegOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Neg<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, NorOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Nor<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, NotOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Not<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, OrOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Or<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, PowOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Pow<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, PowWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: PowWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, RemOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Rem<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, RemWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: RemWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, ShlOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Shl<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, ShlWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: ShlWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, ShrOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Shr<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, ShrWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: ShrWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, SquareOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: Square<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, SquareRootOperation<N>, 1>> for Instruction<N>

Source§

fn from(operation: SquareRoot<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, SubOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Sub<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, SubWrappedOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: SubWrapped<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, TernaryOperation<N>, 3>> for Instruction<N>

Source§

fn from(operation: Ternary<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network> From<Literals<N, XorOperation<N>, 2>> for Instruction<N>

Source§

fn from(operation: Xor<N>) -> Self

Converts to this type from the input type.
Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> FromBytes for Literals<N, O, NUM_OPERANDS>

Source§

fn read_le<R: Read>(reader: R) -> IoResult<Self>

Reads the operation from a buffer.

Source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> FromStr for Literals<N, O, NUM_OPERANDS>

Source§

fn from_str(string: &str) -> Result<Self>

Parses a string into an operation.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<N: Hash + Network, O: Hash + Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Hash for Literals<N, O, NUM_OPERANDS>

Source§

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

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<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Parser for Literals<N, O, NUM_OPERANDS>

Source§

fn parse(string: &str) -> ParserResult<'_, Self>

Parses a string into an operation.

Source§

impl<N: PartialEq + Network, O: PartialEq + Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> PartialEq for Literals<N, O, NUM_OPERANDS>

Source§

fn eq(&self, other: &Literals<N, O, NUM_OPERANDS>) -> 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<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> ToBytes for Literals<N, O, NUM_OPERANDS>

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Writes the operation to a buffer.

Source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
Source§

impl<N: Eq + Network, O: Eq + Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> Eq for Literals<N, O, NUM_OPERANDS>

Source§

impl<N: Network, O: Operation<N, Literal<N>, LiteralType, NUM_OPERANDS>, const NUM_OPERANDS: usize> StructuralPartialEq for Literals<N, O, NUM_OPERANDS>

Auto Trait Implementations§

§

impl<N, O, const NUM_OPERANDS: usize> Freeze for Literals<N, O, NUM_OPERANDS>

§

impl<N, O, const NUM_OPERANDS: usize> RefUnwindSafe for Literals<N, O, NUM_OPERANDS>

§

impl<N, O, const NUM_OPERANDS: usize> Send for Literals<N, O, NUM_OPERANDS>
where O: Send,

§

impl<N, O, const NUM_OPERANDS: usize> Sync for Literals<N, O, NUM_OPERANDS>
where O: Sync,

§

impl<N, O, const NUM_OPERANDS: usize> Unpin for Literals<N, O, NUM_OPERANDS>
where O: Unpin, <N as Environment>::Field: Unpin, <N as Environment>::Projective: Unpin, <N as Environment>::Scalar: Unpin, N: Unpin,

§

impl<N, O, const NUM_OPERANDS: usize> UnwindSafe for Literals<N, O, NUM_OPERANDS>

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, dst: *mut u8)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V