Struct zkinterface::consumers::workspace::Workspace[][src]

pub struct Workspace { /* fields omitted */ }

Workspace finds and reads zkInterface messages from a directory. It supports reading messages one-by-one from large files or from many files. It supports reading from stdin using dash (-) as a special filename.

Example

use zkinterface::{Workspace, WorkspaceSink, Sink, Message};
use zkinterface::producers::examples::*;
use std::path::PathBuf;

// Create an example workspace including multiple constraints files.
let dir = PathBuf::from("local/test_workspace");
let mut sink = WorkspaceSink::new(&dir).unwrap();
sink.push_header(example_circuit_header());
sink.push_witness(example_witness());
sink.push_witness(example_witness());
sink.push_constraints(example_constraints());
sink.push_constraints(example_constraints());

// Iterate over the files and observe the messages.
let mut got = vec![];

let ws = Workspace::from_dir(&dir).unwrap();
for msg in ws.iter_messages() {
    match msg {
        Message::Header(h) => got.push("HEADER"),
        Message::Witness(w) => got.push("WITNESS"),
        Message::ConstraintSystem(cs) => got.push("CONSTRAINTS"),
        _ => {}
    }
}

assert_eq!(got, vec!["HEADER", "WITNESS", "WITNESS", "CONSTRAINTS", "CONSTRAINTS"]);

Implementations

impl Workspace[src]

pub fn from_dir(path: &Path) -> Result<Self>[src]

pub fn from_dirs_and_files(paths: &[PathBuf]) -> Result<Self>[src]

pub fn from_filenames(paths: Vec<PathBuf>) -> Self[src]

pub fn iter_messages<'w>(&'w self) -> impl Iterator<Item = Message> + 'w[src]

pub fn read_all_messages(&self) -> Messages[src]

Trait Implementations

impl Clone for Workspace[src]

impl Debug for Workspace[src]

impl Default for Workspace[src]

impl Eq for Workspace[src]

impl From<&'_ Workspace> for Messages[src]

fn from(ws: &Workspace) -> Messages[src]

Convert from Flatbuffers messages to owned structure.

impl PartialEq<Workspace> for Workspace[src]

impl StructuralEq for Workspace[src]

impl StructuralPartialEq for Workspace[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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