Fields
bits: Vec<Boolean>
negated: bool
value: Option<u8>
Implementations
sourceimpl UInt8
impl UInt8
sourcepub fn constant_vec(values: &[u8]) -> Vec<Self>
pub fn constant_vec(values: &[u8]) -> Vec<Self>
Construct a constant vector of UInt8
from a vector of u8
pub fn alloc_vec<F, CS, T>(
cs: CS,
values: &[T]
) -> Result<Vec<Self>, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
T: Into<Option<u8>> + Copy,
sourcepub fn alloc_input_vec_le<F, CS>(
cs: CS,
values: &[u8]
) -> Result<Vec<Self>, SynthesisError> where
F: PrimeField,
CS: ConstraintSystem<F>,
pub fn alloc_input_vec_le<F, CS>(
cs: CS,
values: &[u8]
) -> Result<Vec<Self>, SynthesisError> where
F: PrimeField,
CS: ConstraintSystem<F>,
Allocates a vector of u8
’s by first converting (chunks of) them to
F
elements, (thus reducing the number of input allocations),
and then converts this list of F
gadgets back into
bytes.
Trait Implementations
sourceimpl<F: Field + PrimeField> Add<F, UInt8> for UInt8
impl<F: Field + PrimeField> Add<F, UInt8> for UInt8
type ErrorType = UnsignedIntegerError
fn add<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, Self::ErrorType>
sourceimpl<F: Field> AllocGadget<<UInt8 as Integer>::IntegerType, F> for UInt8
impl<F: Field> AllocGadget<<UInt8 as Integer>::IntegerType, F> for UInt8
fn alloc<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<<UInt8 as Integer>::IntegerType>, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError>
fn alloc_input<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<<UInt8 as Integer>::IntegerType>, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError>
fn alloc_constant<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
_cs: CS,
_f: Fn
) -> Result<Self, SynthesisError>
fn alloc_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_input_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
sourceimpl<F: Field + PrimeField> ComparatorGadget<F> for UInt8
impl<F: Field + PrimeField> ComparatorGadget<F> for UInt8
fn greater_than<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
fn less_than_or_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
fn greater_than_or_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
sourceimpl<F: PrimeField> CondSelectGadget<F> for UInt8
impl<F: PrimeField> CondSelectGadget<F> for UInt8
fn conditionally_select<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
first: &Self,
second: &Self
) -> Result<Self, SynthesisError>
fn cost() -> usize
sourceimpl<F: Field> ConditionalEqGadget<F> for UInt8
impl<F: Field> ConditionalEqGadget<F> for UInt8
fn conditional_enforce_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self,
condition: &Boolean
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<F: PrimeField> Div<F, UInt8> for UInt8
impl<F: PrimeField> Div<F, UInt8> for UInt8
type ErrorType = UnsignedIntegerError
fn div<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, Self::ErrorType>
sourceimpl<F: Field> EqGadget<F> for UInt8
impl<F: Field> EqGadget<F> for UInt8
sourcefn is_eq<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
fn is_eq<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
Output a Boolean
value representing whether self.value() == other.value()
. Read more
fn enforce_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<F: PrimeField> EvaluateEqGadget<F> for UInt8
impl<F: PrimeField> EvaluateEqGadget<F> for UInt8
fn evaluate_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
sourceimpl<F: Field + PrimeField> EvaluateLtGadget<F> for UInt8
impl<F: Field + PrimeField> EvaluateLtGadget<F> for UInt8
fn less_than<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
sourceimpl Integer for UInt8
impl Integer for UInt8
type IntegerType = u8
type UnsignedGadget = UInt8
type UnsignedIntegerType = u8
const SIZE: usize
fn constant(value: u8) -> Self
fn one() -> Self
fn zero() -> Self
fn new(bits: Vec<Boolean>, value: Option<Self::IntegerType>) -> Self
sourcefn is_constant(&self) -> bool
fn is_constant(&self) -> bool
Returns true if all bits in this Int
are constant
fn to_bits_le(&self) -> Vec<Boolean>
fn to_bits_be(&self) -> Vec<Boolean>
fn from_bits_le(bits: &[Boolean]) -> Self
fn get_value(&self) -> Option<String>
sourcefn result_is_constant(first: &Self, second: &Self) -> bool
fn result_is_constant(first: &Self, second: &Self) -> bool
Returns true if both Int
objects have constant bits
sourceimpl PartialOrd<UInt8> for UInt8
impl PartialOrd<UInt8> for UInt8
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<F: PrimeField> Pow<F, UInt8> for UInt8
impl<F: PrimeField> Pow<F, UInt8> for UInt8
sourcefn pow<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, Self::ErrorType>
fn pow<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, Self::ErrorType>
Bitwise exponentiation of two unsized integers. Reference: /snarkVM/models/src/curves/field.rs
type ErrorType = UnsignedIntegerError
sourceimpl<F: PrimeField> Sub<F, UInt8> for UInt8
impl<F: PrimeField> Sub<F, UInt8> for UInt8
type ErrorType = UnsignedIntegerError
fn sub<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, Self::ErrorType>
sourceimpl<F: Field> ToBytesGadget<F> for UInt8
impl<F: Field> ToBytesGadget<F> for UInt8
fn to_bytes<CS: ConstraintSystem<F>>(
&self,
_cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
sourcefn to_bytes_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
fn to_bytes_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
Additionally checks if the produced list of booleans is ‘valid’.
sourceimpl UInt for UInt8
impl UInt for UInt8
sourcefn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
fn addmany<F: PrimeField, CS: ConstraintSystem<F>>(
cs: CS,
operands: &[Self]
) -> Result<Self, SynthesisError>
Perform modular addition of several UInt
objects.
sourcefn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, UnsignedIntegerError>
fn mul<F: PrimeField, CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, UnsignedIntegerError>
Perform Bitwise multiplication of two UInt
objects.
Reference: https://en.wikipedia.org/wiki/Binary_multiplier Read more
sourceimpl<F: PrimeField> Xor<F, UInt8> for UInt8
impl<F: PrimeField> Xor<F, UInt8> for UInt8
fn xor<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
impl Eq for UInt8
Auto Trait Implementations
impl RefUnwindSafe for UInt8
impl Send for UInt8
impl Sync for UInt8
impl Unpin for UInt8
impl UnwindSafe for UInt8
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, T> ConditionalOrEqualsGadget<F> for T where
F: Field,
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
impl<F, T> ConditionalOrEqualsGadget<F> for T where
F: Field,
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
fn conditional_enforce_equal_or<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
var: &Self,
first: &Self,
second: &Self,
should_enforce: &Boolean
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<F, T> OrEqualsGadget<F> for T where
F: Field,
T: ConditionalOrEqualsGadget<F>,
impl<F, T> OrEqualsGadget<F> for T where
F: Field,
T: ConditionalOrEqualsGadget<F>,
fn enforce_equal_or<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
var: &Self,
first: &Self,
second: &Self
) -> Result<(), SynthesisError>
fn cost() -> usize
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more