Trait ExprOps

Source
pub trait ExprOps<F, ChallengeTerm>:
    Add<Output = Self>
    + Sub<Output = Self>
    + Neg<Output = Self>
    + Mul<Output = Self>
    + AddAssign<Self>
    + MulAssign<Self>
    + Clone
    + Zero
    + One
    + From<u64>
    + Debug
    + Display
where Self: Sized,
{
Show 14 methods // Required methods fn two_pow(pow: u64) -> Self; fn two_to_limb() -> Self; fn two_to_2limb() -> Self; fn two_to_3limb() -> Self; fn double(&self) -> Self; fn square(&self) -> Self; fn pow(&self, p: u64) -> Self; fn boolean(&self) -> Self; fn crumb(&self) -> Self; fn literal(x: F) -> Self; fn witness( row: CurrOrNext, col: usize, env: Option<&ArgumentData<F>>, ) -> Self; fn coeff(col: usize, env: Option<&ArgumentData<F>>) -> Self; fn constant( expr: ConstantExpr<F, ChallengeTerm>, env: Option<&ArgumentData<F>>, ) -> Self; fn cache(&self, cache: &mut Cache) -> Self;
}
Expand description

This trait defines a common arithmetic operations interface that can be used by constraints. It allows us to reuse constraint code for witness computation.

Required Methods§

Source

fn two_pow(pow: u64) -> Self

2^pow

Source

fn two_to_limb() -> Self

2^{LIMB_BITS}

Source

fn two_to_2limb() -> Self

2^{2 * LIMB_BITS}

Source

fn two_to_3limb() -> Self

2^{3 * LIMB_BITS}

Source

fn double(&self) -> Self

Double the value

Source

fn square(&self) -> Self

Compute the square of this value

Source

fn pow(&self, p: u64) -> Self

Raise the value to the given power

Source

fn boolean(&self) -> Self

Constrain to boolean

Source

fn crumb(&self) -> Self

Constrain to crumb (i.e. two bits)

Source

fn literal(x: F) -> Self

Create a literal

Source

fn witness(row: CurrOrNext, col: usize, env: Option<&ArgumentData<F>>) -> Self

Source

fn coeff(col: usize, env: Option<&ArgumentData<F>>) -> Self

Coefficient

Source

fn constant( expr: ConstantExpr<F, ChallengeTerm>, env: Option<&ArgumentData<F>>, ) -> Self

Create a constant

Source

fn cache(&self, cache: &mut Cache) -> Self

Cache item

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§