Struct snarkvm_wasm::fields::AllocatedFp [−][src]
pub struct AllocatedFp<F> where
F: PrimeField, { pub value: Option<F>, pub variable: ConstraintVariable<F>, }
Expand description
Represents a variable in the constraint system whose value can be an arbitrary field element.
Fields
value: Option<F>variable: ConstraintVariable<F>Implementations
impl<F> AllocatedFp<F> where
F: PrimeField, [src]
impl<F> AllocatedFp<F> where
F: PrimeField, [src]pub fn from<CS>(cs: CS, value: &F) -> AllocatedFp<F> where
CS: ConstraintSystem<F>, [src]
CS: ConstraintSystem<F>,
impl<F> AllocatedFp<F> where
F: PrimeField, [src]
impl<F> AllocatedFp<F> where
F: PrimeField, [src]pub fn from_boolean<CS>(
cs: CS,
other: Boolean
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn from_boolean<CS>(
cs: CS,
other: Boolean
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Constructs Self from a Boolean: if other is false, this outputs
zero, else it outputs one.
pub fn is_neq<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn is_neq<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>, [src]Outputs the bit self != other.
This requires three constraints.
Trait Implementations
impl<F> AllocGadget<F, F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> AllocGadget<F, F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn alloc_constant<FN, T, CS>(
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>, [src]
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>,
pub fn alloc<FN, T, CS>(
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>, [src]
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>,
pub fn alloc_input<FN, T, CS>(
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>, [src]
cs: CS,
value_gen: FN
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
T: Borrow<F>,
FN: FnOnce() -> Result<T, SynthesisError>,
fn alloc_checked<Fn, T, CS>(cs: CS, f: Fn) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
CS: ConstraintSystem<F>,
T: Borrow<V>, [src]
Fn: FnOnce() -> Result<T, SynthesisError>,
CS: ConstraintSystem<F>,
T: Borrow<V>,
fn alloc_input_checked<Fn, T, CS>(cs: CS, f: Fn) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
CS: ConstraintSystem<F>,
T: Borrow<V>, [src]
Fn: FnOnce() -> Result<T, SynthesisError>,
CS: ConstraintSystem<F>,
T: Borrow<V>,
impl<F> Clone for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> Clone for AllocatedFp<F> where
F: PrimeField, [src]pub fn clone(&self) -> AllocatedFp<F>[src]
pub fn clone(&self) -> AllocatedFp<F>[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl<F> CondSelectGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> CondSelectGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &AllocatedFp<F>,
second: &AllocatedFp<F>
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &AllocatedFp<F>,
second: &AllocatedFp<F>
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> ConditionalEqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ConditionalEqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn conditional_enforce_equal<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>,
condition: &Boolean
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]
&self,
cs: CS,
other: &AllocatedFp<F>,
condition: &Boolean
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> Debug for AllocatedFp<F> where
F: Debug + PrimeField, [src]
impl<F> Debug for AllocatedFp<F> where
F: Debug + PrimeField, [src]impl<F> EqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> EqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn is_eq<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn is_eq<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>, [src]Output a Boolean value representing whether self.value() == other.value(). Read more
fn enforce_equal<CS>(&self, cs: CS, other: &Self) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]
CS: ConstraintSystem<F>,
fn cost() -> usize[src]
impl<F> From<AllocatedFp<F>> for FpGadget<F> where
F: PrimeField, [src]
impl<F> From<AllocatedFp<F>> for FpGadget<F> where
F: PrimeField, [src]pub fn from(other: AllocatedFp<F>) -> FpGadget<F>[src]
pub fn from(other: AllocatedFp<F>) -> FpGadget<F>[src]Performs the conversion.
impl<F> NEqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> NEqGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn enforce_not_equal<CS>(
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]
&self,
cs: CS,
other: &AllocatedFp<F>
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> PartialEq<AllocatedFp<F>> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> PartialEq<AllocatedFp<F>> for AllocatedFp<F> where
F: PrimeField, [src]impl<F> ThreeBitCondNegLookupGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ThreeBitCondNegLookupGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]type TableConstant = F
pub fn three_bit_cond_neg_lookup<CS>(
cs: CS,
b: &[Boolean],
b0b1: &Boolean,
c: &[<AllocatedFp<F> as ThreeBitCondNegLookupGadget<F>>::TableConstant]
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
b: &[Boolean],
b0b1: &Boolean,
c: &[<AllocatedFp<F> as ThreeBitCondNegLookupGadget<F>>::TableConstant]
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> ToBitsBEGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ToBitsBEGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn to_bits_be<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_bits_be<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Outputs the binary representation of the value in self in big-endian
form.
pub fn to_bits_be_strict<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_bits_be_strict<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Additionally checks if the produced list of booleans is ‘valid’.
impl<F> ToBitsLEGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ToBitsLEGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn to_bits_le<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_bits_le<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Outputs the binary representation of the value in self in little-endian
form.
pub fn to_bits_le_strict<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_bits_le_strict<CS>(
&self,
cs: CS
) -> Result<Vec<Boolean, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Additionally checks if the produced list of booleans is ‘valid’.
impl<F> ToBytesGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ToBytesGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn to_bytes<CS>(&self, cs: CS) -> Result<Vec<UInt8, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
CS: ConstraintSystem<F>,
pub fn to_bytes_strict<CS>(
&self,
cs: CS
) -> Result<Vec<UInt8, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_bytes_strict<CS>(
&self,
cs: CS
) -> Result<Vec<UInt8, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Additionally checks if the produced list of booleans is ‘valid’.
impl<F> ToConstraintFieldGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> ToConstraintFieldGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]pub fn to_constraint_field<CS>(
&self,
_cs: CS
) -> Result<Vec<FpGadget<F>, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn to_constraint_field<CS>(
&self,
_cs: CS
) -> Result<Vec<FpGadget<F>, Global>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Converts self to FpGadget<F> variables.
impl<F> TwoBitLookupGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
impl<F> TwoBitLookupGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]Uses two bits to perform a lookup into a table
b is little-endian: b[0] is LSB.
type TableConstant = F
pub fn two_bit_lookup<CS>(
cs: CS,
b: &[Boolean],
c: &[<AllocatedFp<F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
b: &[Boolean],
c: &[<AllocatedFp<F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> Eq for AllocatedFp<F> where
F: PrimeField, [src]
F: PrimeField,
Auto Trait Implementations
impl<F> RefUnwindSafe for AllocatedFp<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for AllocatedFp<F>
impl<F> Sync for AllocatedFp<F>
impl<F> Unpin for AllocatedFp<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for AllocatedFp<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<F, T> ConditionalOrEqualsGadget<F> for T where
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
F: Field, [src]
impl<F, T> ConditionalOrEqualsGadget<F> for T where
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
F: Field, [src]pub fn conditional_enforce_equal_or<CS>(
cs: CS,
cond: &Boolean,
var: &T,
first: &T,
second: &T,
should_enforce: &Boolean
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
var: &T,
first: &T,
second: &T,
should_enforce: &Boolean
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]pub fn equivalent(&self, key: &K) -> bool[src]
pub fn equivalent(&self, key: &K) -> bool[src]Compare self to key and return true if they are equal.
impl<F, T> OrEqualsGadget<F> for T where
T: ConditionalOrEqualsGadget<F>,
F: Field, [src]
impl<F, T> OrEqualsGadget<F> for T where
T: ConditionalOrEqualsGadget<F>,
F: Field, [src]pub fn enforce_equal_or<CS>(
cs: CS,
cond: &Boolean,
var: &T,
first: &T,
second: &T
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
var: &T,
first: &T,
second: &T
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<T> Pointable for T
impl<T> Pointable for Timpl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
type Output = TShould always be Self
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,