pub struct Program(Box<[Instruction; 512]>);Expand description
Generated HashX program, as a boxed array of instructions
Tuple Fields§
§0: Box<[Instruction; 512]>Implementations§
Source§impl Program
impl Program
Sourcepub(crate) fn generate<T: RngCore>(rng: &mut T) -> Result<Self, Error>
pub(crate) fn generate<T: RngCore>(rng: &mut T) -> Result<Self, Error>
Generate a new Program from an arbitrary RngCore implementer
This can return Error::ProgramConstraints if the HashX
post-generation program verification fails. During normal use this
will happen once per several thousand random seeds, and the caller
should skip to another seed.
Sourcepub(crate) fn interpret(&self, regs: &mut RegisterFile)
pub(crate) fn interpret(&self, regs: &mut RegisterFile)
Reference implementation for Program behavior
Run the program from start to finish, with up to one branch, in the provided register file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnsafeUnpin 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