Struct zkinterface::producers::builder::StatementBuilder[][src]

pub struct StatementBuilder<S: Sink> {
    pub sink: S,
    pub header: CircuitHeader,
}

StatementBuilder assists with constructing and storing a statement in zkInterface format.

Example

use zkinterface::{StatementBuilder, Sink, WorkspaceSink, CircuitHeader, ConstraintSystem, Witness};

// Create a workspace where to write zkInterafce files.
let sink = WorkspaceSink::new("local/test_builder").unwrap();
let mut builder = StatementBuilder::new(sink);

// Use variables, construct a constraint system, and a witness.
let var_ids = builder.allocate_vars(3);
let cs = ConstraintSystem::default();
let witness = Witness::default();

builder.finish_header().unwrap();
builder.push_witness(witness).unwrap();
builder.push_constraints(cs).unwrap();

Fields

sink: Sheader: CircuitHeader

Implementations

impl<S: Sink> StatementBuilder<S>[src]

pub fn new(sink: S) -> StatementBuilder<S>[src]

pub fn allocate_var(&mut self) -> u64[src]

pub fn allocate_vars(&mut self, n: usize) -> Vec<u64>[src]

pub fn allocate_instance_var(&mut self, value: &[u8]) -> u64[src]

pub fn finish_header(&mut self) -> Result<()>[src]

Trait Implementations

impl<S: Sink + GadgetCallbacks> GadgetCallbacks for StatementBuilder<S>[src]

impl<S: Sink> Sink for StatementBuilder<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for StatementBuilder<S> where
    S: RefUnwindSafe

impl<S> Send for StatementBuilder<S> where
    S: Send

impl<S> Sync for StatementBuilder<S> where
    S: Sync

impl<S> Unpin for StatementBuilder<S> where
    S: Unpin

impl<S> UnwindSafe for StatementBuilder<S> where
    S: UnwindSafe

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, U> Into<U> for T where
    U: From<T>, 
[src]

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>,