Struct equix::EquiX

source ·
pub struct EquiX { /* private fields */ }
Expand description

One Equi-X instance, customized for a challenge string

This includes pre-computed state that depends on the puzzle’s challenge as well as any options set via EquiXBuilder.

Implementations§

source§

impl EquiX

source

pub fn new(challenge: &[u8]) -> Result<Self, Error>

Make a new EquiX instance with a challenge string and default 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.

source

pub fn runtime(&self) -> Runtime

Check which actual program runtime is in effect.

By default we try to generate machine code at runtime to accelerate the hash function, but we fall back to an interpreter if this fails. The compiler can be disabled entirely using RuntimeOption::InterpretOnly and EquiXBuilder.

source

pub fn verify(&self, solution: &Solution) -> Result<(), Error>

Check a Solution against this particular challenge.

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.

source

pub fn solve(&self) -> SolutionArray

Search for solutions using this particular challenge.

Returns a buffer with a variable number of solutions. Memory for the solver is allocated dynamically and not reused.

source

pub fn solve_with_memory(&self, mem: &mut SolverMemory) -> SolutionArray

Search for solutions, using the provided SolverMemory.

Returns a buffer with a variable number of solutions.

Allows reuse of solver memory. Preferred for callers which may perform several solve operations in rapid succession, such as in the common case of layering an effort adjustment protocol above Equi-X.

Trait Implementations§

source§

impl Debug for EquiX

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for EquiX

§

impl RefUnwindSafe for EquiX

§

impl Send for EquiX

§

impl Sync for EquiX

§

impl Unpin for EquiX

§

impl UnwindSafe for EquiX

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.