pub struct EquiXBuilder { /* private fields */ }Expand description
Builder for creating EquiX instances with custom settings
Implementations§
Source§impl EquiXBuilder
impl EquiXBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new EquiXBuilder with default settings.
Immediately calling Self::build() would be equivalent to using
EquiX::new().
Sourcepub fn runtime(&mut self, runtime: RuntimeOption) -> &mut Self
pub fn runtime(&mut self, runtime: RuntimeOption) -> &mut Self
Select a new RuntimeOption.
Sourcepub fn build(&self, challenge: &[u8]) -> Result<EquiX, Error>
pub fn build(&self, challenge: &[u8]) -> Result<EquiX, Error>
Build an EquiX instance with a challenge string and the
selected options.
It’s normal for this to fail with a HashError::ProgramConstraints
for a small fraction of challenge values. Those challenges must be
skipped by solvers and rejected by verifiers.
Sourcepub fn solve(&self, challenge: &[u8]) -> Result<SolutionArray, Error>
pub fn solve(&self, challenge: &[u8]) -> Result<SolutionArray, Error>
Search for solutions to a particular challenge.
Each solve invocation returns zero or more solutions. Memory for the solver is allocated dynamically and not reused.
It’s normal for this to fail with a HashError::ProgramConstraints
for a small fraction of challenge values. Those challenges must be
skipped by solvers and rejected by verifiers.
Sourcepub fn verify(&self, challenge: &[u8], solution: &Solution) -> Result<(), Error>
pub fn verify(&self, challenge: &[u8], solution: &Solution) -> Result<(), Error>
Check a Solution against a particular challenge string.
Having a Solution instance guarantees that the order of items
has already been checked. This only needs to check hash tree sums.
Returns either Ok or Error::HashSum.
Sourcepub fn verify_array(
&self,
challenge: &[u8],
array: &SolutionItemArray,
) -> Result<(), Error>
pub fn verify_array( &self, challenge: &[u8], array: &SolutionItemArray, ) -> Result<(), Error>
Check a SolutionItemArray.
Returns an error if the array is not a well formed Solution or it’s
not suitable for the given challenge.
Sourcepub fn verify_bytes(
&self,
challenge: &[u8],
array: &SolutionByteArray,
) -> Result<(), Error>
pub fn verify_bytes( &self, challenge: &[u8], array: &SolutionByteArray, ) -> Result<(), Error>
Check a SolutionByteArray.
Returns an error if the array is not a well formed Solution or it’s
not suitable for the given challenge.
Trait Implementations§
Source§impl Clone for EquiXBuilder
impl Clone for EquiXBuilder
Source§fn clone(&self) -> EquiXBuilder
fn clone(&self) -> EquiXBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more