pub trait ArithInstruction<F: WithSmallOrderMulGroup<3> + Ord>: Chip<F> {
// Required methods
fn add(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>;
fn sub(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>;
fn mul(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>;
}
Expand description
Arithmetic instructions implemented in the chip
Required Methods§
Sourcefn add(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>
fn add( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>
Add two field elements and return their sum
Sourcefn sub(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>
fn sub( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>
Subtract two field elements and return their difference
Sourcefn mul(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>
fn mul( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>
Multiply two field elements and return their product
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.