ark_r1cs_std::cmp

Trait CmpGadget

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

Source

fn is_ge(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Provided Methods§

Source

fn is_gt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source

fn is_lt(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Source

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 ()

Mimics the behavior of std::cmp::PartialOrd for ().

Source§

fn is_gt(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_ge(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_lt(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

fn is_le(&self, _other: &Self) -> Result<Boolean<F>, SynthesisError>

Source§

impl<T: CmpGadget<F>, F: PrimeField> CmpGadget<F> for [T]

Mimics the lexicographic comparison behavior of std::cmp::PartialOrd for [T].

Source§

fn is_ge(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Implementors§

Source§

impl<F: PrimeField> CmpGadget<F> for Boolean<F>

Source§

impl<const N: usize, T: PrimUInt, F: PrimeField + From<T>> CmpGadget<F> for UInt<N, T, F>