Struct miden_core::mast::LoopNode
source · pub struct LoopNode { /* private fields */ }
Expand description
A Loop node defines condition-controlled iterative execution. When the VM encounters a Loop node, it will keep executing the body of the loop as long as the top of the stack is `1``.
The loop is exited when at the end of executing the loop body the top of the stack is 0``. If the top of the stack is neither
0nor
1` when the condition is checked, the execution
fails.
Implementations§
source§impl LoopNode
impl LoopNode
Constructors
pub fn new( body: MastNodeId, mast_forest: &MastForest, ) -> Result<Self, MastForestError>
source§impl LoopNode
impl LoopNode
sourcepub fn digest(&self) -> RpoDigest
pub fn digest(&self) -> RpoDigest
Returns a commitment to this Loop node.
The commitment is computed as a hash of the loop body and an empty word ([ZERO; 4]) in the domain defined by Self::DOMAIN - i..e,:
Hasher::merge_in_domain(&[body_digest, Digest::default()], LoopNode::DOMAIN);
sourcepub fn body(&self) -> MastNodeId
pub fn body(&self) -> MastNodeId
Returns the ID of the node presenting the body of the loop.
Trait Implementations§
impl Eq for LoopNode
impl StructuralPartialEq for LoopNode
Auto Trait Implementations§
impl Freeze for LoopNode
impl RefUnwindSafe for LoopNode
impl Send for LoopNode
impl Sync for LoopNode
impl Unpin for LoopNode
impl UnwindSafe for LoopNode
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)