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 0nor1` when the condition is checked, the execution
fails.
Implementations§
Trait Implementations§
Source§impl MastNodeErrorContext for LoopNode
impl MastNodeErrorContext for LoopNode
Source§fn decorators<'a>(
&'a self,
forest: &'a MastForest,
) -> impl Iterator<Item = DecoratedOpLink> + 'a
fn decorators<'a>( &'a self, forest: &'a MastForest, ) -> impl Iterator<Item = DecoratedOpLink> + 'a
The list of decorators tied to this node, along with their associated index. Read more
Source§fn get_assembly_op<'m>(
&self,
mast_forest: &'m MastForest,
target_op_idx: Option<usize>,
) -> Option<&'m AssemblyOp>
fn get_assembly_op<'m>( &self, mast_forest: &'m MastForest, target_op_idx: Option<usize>, ) -> Option<&'m AssemblyOp>
Returns the
AssemblyOp associated with this node and operation (if provided), if any. Read moreSource§impl MastNodeExt for LoopNode
impl MastNodeExt for LoopNode
Source§fn digest(&self) -> Word
fn digest(&self) -> Word
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, Word::default()], LoopNode::DOMAIN);Source§fn before_enter<'a>(&'a self, forest: &'a MastForest) -> &'a [DecoratorId]
fn before_enter<'a>(&'a self, forest: &'a MastForest) -> &'a [DecoratorId]
Returns the decorators to be executed before this node is executed.
Source§fn after_exit<'a>(&'a self, forest: &'a MastForest) -> &'a [DecoratorId]
fn after_exit<'a>(&'a self, forest: &'a MastForest) -> &'a [DecoratorId]
Returns the decorators to be executed after this node is executed.
Source§type Builder = LoopNodeBuilder
type Builder = LoopNodeBuilder
Converts this node into its corresponding builder, reusing allocated data where possible.
Source§fn to_display<'a>(
&'a self,
mast_forest: &'a MastForest,
) -> Box<dyn Display + 'a>
fn to_display<'a>( &'a self, mast_forest: &'a MastForest, ) -> Box<dyn Display + 'a>
Returns a display formatter for this node.
Source§fn to_pretty_print<'a>(
&'a self,
mast_forest: &'a MastForest,
) -> Box<dyn PrettyPrint + 'a>
fn to_pretty_print<'a>( &'a self, mast_forest: &'a MastForest, ) -> Box<dyn PrettyPrint + 'a>
Returns a pretty printer for this node.
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Returns true if the this node has children.
Source§fn append_children_to(&self, target: &mut Vec<MastNodeId>)
fn append_children_to(&self, target: &mut Vec<MastNodeId>)
Appends the NodeIds of the children of this node, if any, to the vector.
Source§fn for_each_child<F>(&self, f: F)where
F: FnMut(MastNodeId),
fn for_each_child<F>(&self, f: F)where
F: FnMut(MastNodeId),
Executes the given closure for each child of this node.
fn to_builder(self, forest: &MastForest) -> Self::Builder
Source§fn verify_node_in_forest(&self, forest: &MastForest)
fn verify_node_in_forest(&self, forest: &MastForest)
Verifies that this node is stored at the ID in its decorators field in the forest.
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