pub enum Operation<T: WireValue> {
    Input(usize),
    Random(usize),
    Add(usizeusizeusize),
    AddConst(usizeusize, T),
    Sub(usizeusizeusize),
    SubConst(usizeusize, T),
    Mul(usizeusizeusize),
    MulConst(usizeusize, T),
    AssertZero(usize),
    Const(usize, T),
}
Expand description

Defines the individual logic gate operations we can support

Variants

Input(usize)

Read a value from input and emit it on the wire

Random(usize)

Emit a random value on the wire

Add(usizeusizeusize)

Add the two wires together

AddConst(usizeusize, T)

Add the wire and the constant

Sub(usizeusizeusize)

Subtract the final wire from the second wire

SubConst(usizeusize, T)

Subtract the constant value from the wire

Mul(usizeusizeusize)

Multiply the two wires together

MulConst(usizeusize, T)

Multiply the first wire by the constant value

AssertZero(usize)

Assert that the wire has the const value zero

Const(usize, T)

Emit the const value on the wire

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Generate a random value of T, using rng as the source of randomness.

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more

Performs the conversion.

Performs the conversion.

For gates that include constant data (AddConst, MulConst, etc) provides a method to access the constant. Returns None for all other types of gates. Read more

For convenience, allows access to the (optional) output, since each gate only ever has one at most. Read more

Used to produce an identity gate on the current field when needed.

Used to produce an identity gate on the current field when needed.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

takes an iterator of input wires and an iterator of output wires, and creates a new gate of the same type using the inputs and outputs. The current input and output wires have no bearing on the new wires, just the gate type. Read more

Takes a hashmap, and looks for existing wires in the keys. Replaces any existing wire keys with the value from the hashmap. Read more

Calls a function on the I/O wires and replaces them with the output of the function.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.