forked from filecoin-project/bellperson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move generic circuit gadgets into bellman
- Loading branch information
Showing
12 changed files
with
4,963 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pub mod test; | ||
|
||
pub mod boolean; | ||
pub mod multieq; | ||
pub mod uint32; | ||
pub mod blake2s; | ||
pub mod num; | ||
pub mod lookup; | ||
pub mod multipack; | ||
pub mod sha256; | ||
|
||
use crate::{ | ||
SynthesisError | ||
}; | ||
|
||
// TODO: This should probably be removed and we | ||
// should use existing helper methods on `Option` | ||
// for mapping with an error. | ||
/// This basically is just an extension to `Option` | ||
/// which allows for a convenient mapping to an | ||
/// error on `None`. | ||
pub trait Assignment<T> { | ||
fn get(&self) -> Result<&T, SynthesisError>; | ||
} | ||
|
||
impl<T> Assignment<T> for Option<T> { | ||
fn get(&self) -> Result<&T, SynthesisError> { | ||
match *self { | ||
Some(ref v) => Ok(v), | ||
None => Err(SynthesisError::AssignmentMissing) | ||
} | ||
} | ||
} |
Oops, something went wrong.