Trait CheckedNat

Source
pub trait CheckedNat<F: FieldWitness, const NBITS: usize>:
    Sized
    + ToFieldElements<F>
    + Check<F>
    + Clone {
    type Inner: MinMax + Magnitude;

Show 23 methods // Required methods fn to_field(&self) -> F; fn from_field(field: F) -> Self; // Provided methods fn zero() -> Self { ... } fn one() -> Self { ... } fn to_inner(&self) -> Self::Inner { ... } fn from_inner(inner: Self::Inner) -> Self { ... } fn gte(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn lte(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn less_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn const_gte(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn const_less_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn const_greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn equal(&self, other: &Self, w: &mut Witness<F>) -> Boolean { ... } fn subtract_unpacking_or_zero( &self, y: &Self, w: &mut Witness<F>, ) -> (Boolean, Self) { ... } fn sub_or_zero(&self, y: &Self, w: &mut Witness<F>) -> (Boolean, Self) { ... } fn div_mod(&self, y: &Self, w: &mut Witness<F>) -> (Self, Self) { ... } fn add(&self, y: &Self, w: &mut Witness<F>) -> Self { ... } fn const_add(&self, y: &Self, w: &mut Witness<F>) -> Self { ... } fn mul(&self, y: &Self, w: &mut Witness<F>) -> Self { ... } fn const_mul(&self, y: &Self, w: &mut Witness<F>) -> Self { ... } fn min(&self, b: &Self, w: &mut Witness<F>) -> Self { ... } fn succ(&self) -> Self { ... }
}

Required Associated Types§

Required Methods§

Source

fn to_field(&self) -> F

Source

fn from_field(field: F) -> Self

Provided Methods§

Source

fn zero() -> Self

Source

fn one() -> Self

Source

fn to_inner(&self) -> Self::Inner

Source

fn from_inner(inner: Self::Inner) -> Self

Source

fn gte(&self, other: &Self, w: &mut Witness<F>) -> Boolean

= greater than or equal

Source

fn lte(&self, other: &Self, w: &mut Witness<F>) -> Boolean

<= less than or equal

Source

fn less_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean

< less than

Source

fn const_gte(&self, other: &Self, w: &mut Witness<F>) -> Boolean

TODO: Remove this

Source

fn const_less_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean

Source

fn greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean

greater than

Source

fn const_greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean

Source

fn equal(&self, other: &Self, w: &mut Witness<F>) -> Boolean

Source

fn subtract_unpacking_or_zero( &self, y: &Self, w: &mut Witness<F>, ) -> (Boolean, Self)

Source

fn sub_or_zero(&self, y: &Self, w: &mut Witness<F>) -> (Boolean, Self)

Returns (is_underflow, value)

Source

fn div_mod(&self, y: &Self, w: &mut Witness<F>) -> (Self, Self)

(div, remainder)

Source

fn add(&self, y: &Self, w: &mut Witness<F>) -> Self

Source

fn const_add(&self, y: &Self, w: &mut Witness<F>) -> Self

Source

fn mul(&self, y: &Self, w: &mut Witness<F>) -> Self

Source

fn const_mul(&self, y: &Self, w: &mut Witness<F>) -> Self

Source

fn min(&self, b: &Self, w: &mut Witness<F>) -> Self

Source

fn succ(&self) -> Self

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§