Trait ark_r1cs_std::alloc::AllocVar[][src]

pub trait AllocVar<V, F: Field> where
    Self: Sized,
    V: ?Sized
{ fn new_variable<T: Borrow<V>>(
        cs: impl Into<Namespace<F>>,
        f: impl FnOnce() -> Result<T, SynthesisError>,
        mode: AllocationMode
    ) -> Result<Self, SynthesisError>; fn new_constant(
        cs: impl Into<Namespace<F>>,
        t: impl Borrow<V>
    ) -> Result<Self, SynthesisError> { ... }
fn new_input<T: Borrow<V>>(
        cs: impl Into<Namespace<F>>,
        f: impl FnOnce() -> Result<T, SynthesisError>
    ) -> Result<Self, SynthesisError> { ... }
fn new_witness<T: Borrow<V>>(
        cs: impl Into<Namespace<F>>,
        f: impl FnOnce() -> Result<T, SynthesisError>
    ) -> Result<Self, SynthesisError> { ... } }

Specifies how variables of type Self should be allocated in a ConstraintSystem.

Required methods

fn new_variable<T: Borrow<V>>(
    cs: impl Into<Namespace<F>>,
    f: impl FnOnce() -> Result<T, SynthesisError>,
    mode: AllocationMode
) -> Result<Self, SynthesisError>
[src]

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.

Loading content...

Provided methods

fn new_constant(
    cs: impl Into<Namespace<F>>,
    t: impl Borrow<V>
) -> Result<Self, SynthesisError>
[src]

Allocates a new constant of type Self in the ConstraintSystem cs.

This should not allocate any new variables or constraints in cs.

fn new_input<T: Borrow<V>>(
    cs: impl Into<Namespace<F>>,
    f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
[src]

Allocates a new public input of type Self in the ConstraintSystem cs.

fn new_witness<T: Borrow<V>>(
    cs: impl Into<Namespace<F>>,
    f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
[src]

Allocates a new private witness of type Self in the ConstraintSystem cs.

Loading content...

Implementations on Foreign Types

impl<I, F: Field, A: AllocVar<I, F>> AllocVar<[I], F> for Vec<A>[src]

This blanket implementation just allocates variables in Self element by element.

Loading content...

Implementors

impl<BF, P> AllocVar<CubicExtField<P>, <P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
    BF: FieldVar<P::BaseField, P::BasePrimeField>,
    &'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
    P: CubicExtVarParams<BF>, 
[src]

impl<BF, P> AllocVar<QuadExtField<P>, <P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
    BF: FieldVar<P::BaseField, P::BasePrimeField>,
    &'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
    P: QuadExtVarParams<BF>, 
[src]

impl<ConstraintF: Field> AllocVar<u8, ConstraintF> for UInt8<ConstraintF>[src]

impl<ConstraintF: Field> AllocVar<u16, ConstraintF> for UInt16<ConstraintF>[src]

impl<ConstraintF: Field> AllocVar<u32, ConstraintF> for UInt32<ConstraintF>[src]

impl<ConstraintF: Field> AllocVar<u64, ConstraintF> for UInt64<ConstraintF>[src]

impl<ConstraintF: Field> AllocVar<u128, ConstraintF> for UInt128<ConstraintF>[src]

impl<F: Field> AllocVar<bool, F> for Boolean<F>[src]

impl<F: Field> AllocVar<bool, F> for AllocatedBit<F>[src]

fn new_variable<T: Borrow<bool>>(
    cs: impl Into<Namespace<F>>,
    f: impl FnOnce() -> Result<T, SynthesisError>,
    mode: AllocationMode
) -> Result<Self, SynthesisError>
[src]

Produces a new variable of the appropriate kind (instance or witness), with a booleanity check.

N.B.: we could omit the booleanity check when allocating self as a new public input, but that places an additional burden on protocol designers. Better safe than sorry!

impl<F: PrimeField> AllocVar<F, F> for FpVar<F>[src]

impl<F: PrimeField> AllocVar<F, F> for AllocatedFp<F>[src]

impl<P, F> AllocVar<GroupAffine<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
    P: SWModelParameters,
    F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
    &'a F: FieldOpsBounds<'a, P::BaseField, F>, 
[src]

impl<P, F> AllocVar<GroupProjective<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
    P: SWModelParameters,
    F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
    &'a F: FieldOpsBounds<'a, P::BaseField, F>, 
[src]

impl<P, F> AllocVar<GroupAffine<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
    P: TEModelParameters,
    F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField> + TwoBitLookupGadget<<P::BaseField as Field>::BasePrimeField, TableConstant = P::BaseField>,
    &'a F: FieldOpsBounds<'a, P::BaseField, F>, 
[src]

impl<P, F> AllocVar<GroupProjective<P>, <<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
    P: TEModelParameters,
    F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField> + TwoBitLookupGadget<<P::BaseField as Field>::BasePrimeField, TableConstant = P::BaseField>,
    &'a F: FieldOpsBounds<'a, P::BaseField, F>, 
[src]

impl<P: Bls12Parameters> AllocVar<G1Prepared<P>, <P as Bls12Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G1PreparedVar<P>[src]

impl<P: Bls12Parameters> AllocVar<G2Prepared<P>, <P as Bls12Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G2PreparedVar<P>[src]

impl<P: MNT4Parameters> AllocVar<G1Prepared<P>, <P as MNT4Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G1PreparedVar<P>[src]

impl<P: MNT4Parameters> AllocVar<G2Prepared<P>, <P as MNT4Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G2PreparedVar<P>[src]

impl<P: MNT6Parameters> AllocVar<G1Prepared<P>, <P as MNT6Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G1PreparedVar<P>[src]

impl<P: MNT6Parameters> AllocVar<G2Prepared<P>, <P as MNT6Parameters>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G2PreparedVar<P>[src]

Loading content...