Struct zkinterface::consumers::workspace::Workspace [−][src]
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]
impl PartialEq<Workspace> for Workspace
[src]
impl StructuralEq for Workspace
[src]
impl StructuralPartialEq for Workspace
[src]
Auto Trait Implementations
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnwindSafe for Workspace
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,