pub trait CmpGadget<F: Field>: R1CSVar<F> + EqGadget<F> {
// Required method
fn is_ge(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>;
// Provided methods
fn is_gt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError> { ... }
fn is_lt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError> { ... }
fn is_le(&self, other: &Self) -> Result<Boolean<F>, SynthesisError> { ... }
}
Expand description
Specifies how to generate constraints for comparing two variables.
Required Methods§
fn is_ge(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>
Provided Methods§
fn is_gt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>
fn is_lt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>
fn is_le(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>
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.
Implementations on Foreign Types§
Source§impl<F: Field> CmpGadget<F> for ()
impl<F: Field> CmpGadget<F> for ()
Mimics the behavior of std::cmp::PartialOrd
for ()
.
fn is_gt(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>
fn is_ge(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>
fn is_lt(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>
fn is_le(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>
Source§impl<T: CmpGadget<F>, F: PrimeField> CmpGadget<F> for [T]
impl<T: CmpGadget<F>, F: PrimeField> CmpGadget<F> for [T]
Mimics the lexicographic comparison behavior of std::cmp::PartialOrd
for [T]
.