CombineOperation

Enum CombineOperation 

Source
pub enum CombineOperation {
    GF2(Operation<bool>),
    Z64(Operation<u64>),
    B2A(usize, usize),
    SizeHint(usize, usize),
}
Expand description

Wraps Operation to define a field for each gate. Also supports conversions and metadata.

Variants§

§

GF2(Operation<bool>)

Circuit Operation on GF2 Finite Field

§

Z64(Operation<u64>)

Circuit Operation on 64-bit integer ring

§

B2A(usize, usize)

Converts a value on GF2 to a value on Z64. Takes: (dst, src) where src is the low bit of the 64-bit GF2 slice. This means that the least significant bit of the Z64 value will come from the GF2 wire with the lowest index. Make sure your circuits are designed accordingly.

§

SizeHint(usize, usize)

Information about the number of wires needed to evaluate the circuit. As with B2A, first item is Z64, second is GF2.

Trait Implementations§

Source§

impl Clone for CombineOperation

Source§

fn clone(&self) -> CombineOperation

Returns a duplicate 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 Debug for CombineOperation

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CombineOperation

Source§

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 From<Operation<bool>> for CombineOperation

Source§

fn from(op: Operation<bool>) -> Self

Converts to this type from the input type.
Source§

impl From<Operation<u64>> for CombineOperation

Source§

fn from(op: Operation<u64>) -> Self

Converts to this type from the input type.
Source§

impl HasConst<bool> for CombineOperation

Source§

fn constant(&self) -> Option<bool>

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

impl HasConst<u64> for CombineOperation

Source§

fn constant(&self) -> Option<u64>

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

impl HasIO for CombineOperation

Source§

fn inputs(&self) -> InputIterator<'_, CombineOperation>

Source§

fn outputs(&self) -> OutputIterator<'_, CombineOperation>

Source§

fn dst<'a>(&'a self) -> Option<usize>
where Self: 'a + Sized, OutputIterator<'a, Self>: Iterator<Item = usize>,

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

impl Identity<bool> for CombineOperation

Source§

fn is_identity(&self) -> bool

Source§

fn identity(w_out: usize, w_in: usize) -> Self

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

impl Identity<u64> for CombineOperation

Source§

fn is_identity(&self) -> bool

Source§

fn identity(w_out: usize, w_in: usize) -> Self

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

impl PartialEq for CombineOperation

Source§

fn eq(&self, other: &CombineOperation) -> 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 Serialize for CombineOperation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Translatable for CombineOperation

Source§

fn translate<'a, I1, I2>(&self, win: I1, wout: I2) -> Option<Self>
where Self: Sized, I1: Iterator<Item = usize>, I2: Iterator<Item = usize>,

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

fn translate_from_hashmap<'a>( &'a self, translation_table: HashMap<usize, usize>, ) -> Option<Self>
where Self: Sized + HasIO, InputIterator<'a, Self>: Iterator<Item = usize>, OutputIterator<'a, Self>: Iterator<Item = usize>,

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

fn translate_from_fn<'a>( &'a self, input_mapper: fn(usize) -> usize, output_mapper: fn(usize) -> usize, ) -> Option<Self>
where Self: Sized + HasIO, InputIterator<'a, Self>: Iterator<Item = usize>, OutputIterator<'a, Self>: Iterator<Item = usize>,

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

impl Copy for CombineOperation

Source§

impl<T: WireValue> Gate<T> for CombineOperation

Source§

impl StructuralPartialEq for CombineOperation

Auto Trait Implementations§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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, 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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,