pub struct Namespace<'a, E: Engine, CS: ConstraintSystem<E> + 'a>(/* private fields */);
Expand description
This is a “namespaced” constraint system which borrows a constraint system (pushing a namespace context) and, when dropped, pops out of the namespace context.
Trait Implementations§
Source§impl<'cs, E: Engine, CS: ConstraintSystem<E>> ConstraintSystem<E> for Namespace<'cs, E, CS>
impl<'cs, E: Engine, CS: ConstraintSystem<E>> ConstraintSystem<E> for Namespace<'cs, E, CS>
Source§type Root = <CS as ConstraintSystem<E>>::Root
type Root = <CS as ConstraintSystem<E>>::Root
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>
fn alloc<F, A, AR>( &mut self, annotation: A, f: F, ) -> Result<Variable, SynthesisError>
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>
fn alloc_input<F, A, AR>( &mut self, annotation: A, f: F, ) -> Result<Variable, SynthesisError>
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)where
A: FnOnce() -> AR,
AR: Into<String>,
LA: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
LB: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
LC: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
fn enforce<A, AR, LA, LB, LC>(&mut self, annotation: A, a: LA, b: LB, c: LC)where
A: FnOnce() -> AR,
AR: Into<String>,
LA: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
LB: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
LC: FnOnce(LinearCombination<E>) -> LinearCombination<E>,
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, _: N)
fn push_namespace<NR, N>(&mut self, _: N)
Create a new (sub)namespace and enter into it. Not intended
for downstream use; use
namespace
instead.Source§fn pop_namespace(&mut self)
fn pop_namespace(&mut self)
Exit out of the existing namespace. Not intended for
downstream use; use
namespace
instead.Auto Trait Implementations§
impl<'a, E, CS> Freeze for Namespace<'a, E, CS>
impl<'a, E, CS> RefUnwindSafe for Namespace<'a, E, CS>where
CS: RefUnwindSafe,
E: RefUnwindSafe,
impl<'a, E, CS> Send for Namespace<'a, E, CS>where
CS: Send,
impl<'a, E, CS> Sync for Namespace<'a, E, CS>where
CS: Sync,
impl<'a, E, CS> Unpin for Namespace<'a, E, CS>where
E: Unpin,
impl<'a, E, CS> !UnwindSafe for Namespace<'a, E, CS>
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
Mutably borrows from an owned value. Read more