Struct TestConstraintSystem

Source
pub struct TestConstraintSystem<E: Engine> { /* private fields */ }
Expand description

Constraint system for testing purposes.

Implementations§

Source§

impl<E: Engine> TestConstraintSystem<E>

Source

pub fn new() -> TestConstraintSystem<E>

Source

pub fn pretty_print(&self) -> String

Source

pub fn find_unconstrained(&self) -> String

Source

pub fn hash(&self) -> String

Source

pub fn which_is_unsatisfied(&self) -> Option<&str>

Source

pub fn is_satisfied(&self) -> bool

Source

pub fn num_constraints(&self) -> usize

Source

pub fn set(&mut self, path: &str, to: E::Fr)

Source

pub fn verify(&self, expected: &[E::Fr]) -> bool

Source

pub fn num_inputs(&self) -> usize

Source

pub fn get_input(&mut self, index: usize, path: &str) -> E::Fr

Source

pub fn get(&mut self, path: &str) -> E::Fr

Trait Implementations§

Source§

impl<E: Engine> ConstraintSystem<E> for TestConstraintSystem<E>

Source§

type Root = TestConstraintSystem<E>

Represents the type of the “root” of this constraint system so that nested namespaces can minimize indirection.
Source§

fn alloc<F, A, AR>( &mut self, annotation: A, f: F, ) -> Result<Variable, SynthesisError>
where F: FnOnce() -> Result<E::Fr, SynthesisError>, A: FnOnce() -> AR, AR: Into<String>,

Allocate a private variable in the constraint system. The provided function is used to determine the assignment of the variable. The given annotation function is invoked in testing contexts in order to derive a unique name for this variable in the current namespace.
Source§

fn alloc_input<F, A, AR>( &mut self, annotation: A, f: F, ) -> Result<Variable, SynthesisError>
where F: FnOnce() -> Result<E::Fr, SynthesisError>, A: FnOnce() -> AR, AR: Into<String>,

Allocate a public variable in the constraint system. The provided function is used to determine the assignment of the variable.
Source§

fn enforce<A, AR, LA, LB, LC>(&mut self, annotation: A, a: LA, b: LB, c: LC)

Enforce that A * B = C. The annotation function is invoked in testing contexts in order to derive a unique name for the constraint in the current namespace.
Source§

fn push_namespace<NR, N>(&mut self, name_fn: N)
where NR: Into<String>, N: FnOnce() -> NR,

Create a new (sub)namespace and enter into it. Not intended for downstream use; use namespace instead.
Source§

fn pop_namespace(&mut self)

Exit out of the existing namespace. Not intended for downstream use; use namespace instead.
Source§

fn get_root(&mut self) -> &mut Self::Root

Gets the “root” constraint system, bypassing the namespacing. Not intended for downstream use; use namespace instead.
Source§

fn one() -> Variable

Return the “one” input variable
Source§

fn namespace<'a, NR, N>( &'a mut self, name_fn: N, ) -> Namespace<'a, E, Self::Root>
where NR: Into<String>, N: FnOnce() -> NR,

Begin a namespace for this constraint system.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.