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

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.

§

CS(Rc<RefCell<ConstraintSystem<F>>>)

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

Implementations§

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

Returns true is self == ConstraintSystemRef::None.

Construct a ConstraintSystemRef from a ConstraintSystem.

Consumes self to return the inner ConstraintSystem<F>. Returns None if Self::CS is None or if any other references to Self::CS exist.

Obtain an immutable reference to the underlying ConstraintSystem.

Panics

This method panics if self is already mutably borrowed.

Obtain a mutable reference to the underlying ConstraintSystem.

Panics

This method panics if self is already mutably borrowed.

Set self.mode to mode.

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

Returns the number of constraints.

Returns the number of instance variables.

Returns the number of witness variables.

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

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

Check whether or not self will construct matrices.

Obtain a variable representing a new public instance input.

Obtain a variable representing a new private witness input.

Obtain a variable representing a linear combination.

Enforce a R1CS constraint with the name name.

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.

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

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.

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(()).

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(()).

Obtain the assignment corresponding to the Variable v.

Get trace information about all constraints in the system

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more