snarkvm_synthesizer_program::logic::instruction

Trait Operation

Source
pub trait Operation<N: Network, Value: Parser + ToBits, ValueType: Parser, const NUM_OPERANDS: usize> {
    const OPCODE: Opcode;

    // Required methods
    fn evaluate(inputs: &[Value; NUM_OPERANDS]) -> Result<Value>;
    fn execute<A: Aleo<Network = N>>(
        inputs: &[Literal<A>; NUM_OPERANDS],
    ) -> Result<Literal<A>>;
    fn output_type(inputs: &[ValueType; NUM_OPERANDS]) -> Result<ValueType>;
}

Required Associated Constants§

Source

const OPCODE: Opcode

The opcode of the operation.

Required Methods§

Source

fn evaluate(inputs: &[Value; NUM_OPERANDS]) -> Result<Value>

Returns the result of evaluating the operation on the given inputs.

Source

fn execute<A: Aleo<Network = N>>( inputs: &[Literal<A>; NUM_OPERANDS], ) -> Result<Literal<A>>

Returns the result of executing the operation on the given circuit inputs.

Source

fn output_type(inputs: &[ValueType; NUM_OPERANDS]) -> Result<ValueType>

Returns the output type from the given input types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for AbsOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for AbsWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for DoubleOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for InvOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for NegOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for NotOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for SquareOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 1> for SquareRootOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for AddOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for AddWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for AndOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for DivOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for DivWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for GreaterThanOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for GreaterThanOrEqualOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for LessThanOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for LessThanOrEqualOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for ModuloOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for MulOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for MulWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for NandOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for NorOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for OrOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for PowOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for PowWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for RemOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for RemWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for ShlOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for ShlWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for ShrOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for ShrWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for SubOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for SubWrappedOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 2> for XorOperation<N>

Source§

impl<N: Network> Operation<N, Literal<N>, LiteralType, 3> for TernaryOperation<N>