pub trait Ring: Unit + PartialEq {
const ONE: Self;
// Required methods
fn add(self, other: Self) -> Self;
fn mul(self, other: Self) -> Self;
}Expand description
The arithmetic a value type needs to appear in a linear equation.
Unit supplies zero and cloning; this adds one, addition, and
multiplication, which is what evaluating Σ weight_i · value_i and giving
a bare wire the weight one require.
The integer units form the Boolean ring: addition is XOR, multiplication is AND, and one is all ones. A weight is then a bit mask and an equation is an XOR relation between masked wires, which is what a statement about a byte-oriented permutation needs. A field unit uses its field arithmetic.
Required Associated Constants§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".