pub struct Circuit { /* private fields */ }Expand description
An artifact that represents a built circuit.
The difference from ConstraintSystem is that a circuit retains enough information to
perform circuit evaluation to generate internal witness values.
Implementations§
Source§impl Circuit
impl Circuit
Sourcepub fn witness_index(&self, wire: Wire) -> ValueIndex
pub fn witness_index(&self, wire: Wire) -> ValueIndex
For the given wire, returns its index in the witness vector.
Sourcepub fn new_witness_filler(&self) -> WitnessFiller<'_>
pub fn new_witness_filler(&self) -> WitnessFiller<'_>
Creates a new witness filler for this circuit.
Sourcepub fn populate_wire_witness(
&self,
w: &mut WitnessFiller<'_>,
) -> Result<(), PopulateError>
pub fn populate_wire_witness( &self, w: &mut WitnessFiller<'_>, ) -> Result<(), PopulateError>
Populates non-input values (wires) in the witness.
Specifically, this will evaluate the circuit gate-by-gate and save the results in the witness vector.
This function expects that the input wires are already filled. The input wires are
CircuitBuilder::add_inout,CircuitBuilder::add_witnessthat were not created by the gates,
The wires created by CircuitBuilder::add_constant (and its convenience methods)
are automatically populated by this function as well.
§Errors
In case the circuit is not satisfiable (any assertion fails), this function will return an error with a list of assertion failure messages.
Sourcepub fn constraint_system(&self) -> &ConstraintSystem
pub fn constraint_system(&self) -> &ConstraintSystem
Returns the constraint system for this circuit.
Sourcepub fn n_gates(&self) -> usize
pub fn n_gates(&self) -> usize
Returns the number of gates in this circuit.
Depending on what type of gates this circuit uses, the number of constraints might be significantly larger.
Sourcepub fn n_eval_insn(&self) -> usize
pub fn n_eval_insn(&self) -> usize
Returns the number of evaluation instructions in this circuit.
Sourcepub fn simple_json_dump(&self) -> String
pub fn simple_json_dump(&self) -> String
Returns a string with a JSON dump that is useful to profile the circuit.
Auto Trait Implementations§
impl Freeze for Circuit
impl !RefUnwindSafe for Circuit
impl Send for Circuit
impl Sync for Circuit
impl Unpin for Circuit
impl UnsafeUnpin for Circuit
impl !UnwindSafe for Circuit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more