Enum ark_relations::r1cs::ConstraintSystemRef[][src]

pub enum ConstraintSystemRef<F: Field> {
    None,
    CS(Rc<RefCell<ConstraintSystem<F>>>),
}

A shared reference to a constraint system that can be stored in high level variables.

Variants

None

Represents the case where we don’t need to allocate variables or enforce constraints. Encountered when operating over constant values.

Represents the case where we do allocate variables or enforce constraints.

Implementations

impl<F: Field> ConstraintSystemRef<F>[src]

pub fn or(self, other: Self) -> Self[src]

Returns self if !self.is_none(), otherwise returns other.

pub fn is_none(&self) -> bool[src]

Returns true is self == ConstraintSystemRef::None.

pub fn new(inner: ConstraintSystem<F>) -> Self[src]

Construct a ConstraintSystemRef from a ConstraintSystem.

pub fn borrow(&self) -> Option<Ref<'_, ConstraintSystem<F>>>[src]

Obtain an immutable reference to the underlying ConstraintSystem.

Panics

This method panics if self is already mutably borrowed.

pub fn borrow_mut(&self) -> Option<RefMut<'_, ConstraintSystem<F>>>[src]

Obtain a mutable reference to the underlying ConstraintSystem.

Panics

This method panics if self is already mutably borrowed.

pub fn set_mode(&self, mode: SynthesisMode)[src]

Set self.mode to mode.

pub fn is_in_setup_mode(&self) -> bool[src]

Check whether self.mode == SynthesisMode::Setup.

pub fn num_constraints(&self) -> usize[src]

Returns the number of constraints.

pub fn num_instance_variables(&self) -> usize[src]

Returns the number of instance variables.

pub fn num_witness_variables(&self) -> usize[src]

Returns the number of witness variables.

pub fn optimization_goal(&self) -> OptimizationGoal[src]

Check whether this constraint system aims to optimize weight, number of constraints, or neither.

pub fn set_optimization_goal(&self, goal: OptimizationGoal)[src]

Specify whether this constraint system should aim to optimize weight, number of constraints, or neither.

pub fn should_construct_matrices(&self) -> bool[src]

Check whether or not self will construct matrices.

pub fn new_input_variable<Func>(&self, f: Func) -> Result<Variable> where
    Func: FnOnce() -> Result<F>, 
[src]

Obtain a variable representing a new public instance input.

pub fn new_witness_variable<Func>(&self, f: Func) -> Result<Variable> where
    Func: FnOnce() -> Result<F>, 
[src]

Obtain a variable representing a new private witness input.

pub fn new_lc(&self, lc: LinearCombination<F>) -> Result<Variable>[src]

Obtain a variable representing a linear combination.

pub fn enforce_constraint(
    &self,
    a: LinearCombination<F>,
    b: LinearCombination<F>,
    c: LinearCombination<F>
) -> Result<()>
[src]

Enforce a R1CS constraint with the name name.

pub fn inline_all_lcs(&self)[src]

Naively inlines symbolic linear combinations into the linear combinations that use them.

Useful for standard pairing-based SNARKs where addition gates are cheap. For example, in the SNARKs such as [Groth16] and [Groth-Maller17], addition gates do not contribute to the size of the multi-scalar multiplication, which is the dominating cost.

pub fn finalize(&self)[src]

Finalize the constraint system (either by outlining or inlining, if an optimization goal is set).

pub fn to_matrices(&self) -> Option<ConstraintMatrices<F>>[src]

This step must be called after constraint generation has completed, and after all symbolic LCs have been inlined into the places that they are used.

pub fn is_satisfied(&self) -> Result<bool>[src]

If self is satisfied, outputs Ok(true). If self is unsatisfied, outputs Ok(false). If self.is_in_setup_mode() or if self == None, outputs Err(()).

pub fn which_is_unsatisfied(&self) -> Result<Option<String>>[src]

If self is satisfied, outputs Ok(None). If self is unsatisfied, outputs Some(i), where i is the index of the first unsatisfied constraint. If self.is_in_setup_mode() or self == None, outputs Err(()).

pub fn assigned_value(&self, v: Variable) -> Option<F>[src]

Obtain the assignment corresponding to the Variable v.

pub fn constraint_names(&self) -> Option<Vec<String>>[src]

Get trace information about all constraints in the system

Trait Implementations

impl<F: Clone + Field> Clone for ConstraintSystemRef<F>[src]

impl<F: Debug + Field> Debug for ConstraintSystemRef<F>[src]

impl<F: Field> Eq for ConstraintSystemRef<F>[src]

impl<F: Field> From<ConstraintSystemRef<F>> for Namespace<F>[src]

impl<F: Field> PartialEq<ConstraintSystemRef<F>> for ConstraintSystemRef<F>[src]

Auto Trait Implementations

impl<F> !Send for ConstraintSystemRef<F>

impl<F> !Sync for ConstraintSystemRef<F>

impl<F> Unpin for ConstraintSystemRef<F>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,