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§
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 const_less_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean
Sourcefn greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean
fn greater_than(&self, other: &Self, w: &mut Witness<F>) -> Boolean
greater than
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)
Sourcefn sub_or_zero(&self, y: &Self, w: &mut Witness<F>) -> (Boolean, Self)
fn sub_or_zero(&self, y: &Self, w: &mut Witness<F>) -> (Boolean, Self)
Returns (is_underflow, value)
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
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.