pub struct Program { /* private fields */ }Expand description
Represents a program, implementing some kind of boolean circuit.
The programs represent boolean circuits using a sequence of stack-based operations.
Implementations§
Source§impl Program
impl Program
Sourcepub fn new(operations: impl Into<Vec<Operation>>) -> Self
pub fn new(operations: impl Into<Vec<Operation>>) -> Self
Create a program from a list of operations.
The program will execute the operations in order.
Sourcepub fn validate(self) -> Result<ValidatedProgram, ProgramError>
pub fn validate(self) -> Result<ValidatedProgram, ProgramError>
Validate that a program is well formed.
A program isn’t well formed if it attempts to pop an element off of an empty stack, or access some other undefined element.
We produce a new struct to allow for reusing the validated result without redoing the logic.
Trait Implementations§
impl StructuralPartialEq for Program
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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