pub struct SplitNode { /* private fields */ }Expand description
A Split node defines conditional execution. When the VM encounters a Split node it executes
either the on_true child or on_false child.
Which child is executed is determined based on the top of the stack. If the value is 1, then
the on_true child is executed. If the value is 0, then the on_false child is executed. If
the value is neither 0 nor 1, the execution fails.
Implementations§
Source§impl SplitNode
Public accessors
impl SplitNode
Public accessors
Sourcepub fn on_true(&self) -> MastNodeId
pub fn on_true(&self) -> MastNodeId
Returns the ID of the node which is to be executed if the top of the stack is 1.
Sourcepub fn on_false(&self) -> MastNodeId
pub fn on_false(&self) -> MastNodeId
Returns the ID of the node which is to be executed if the top of the stack is 0.
Trait Implementations§
Source§impl MastNodeErrorContext for SplitNode
impl MastNodeErrorContext for SplitNode
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
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>
AssemblyOp associated with this node and operation (if provided), if any. Read moreSource§impl MastNodeExt for SplitNode
impl MastNodeExt for SplitNode
Source§fn digest(&self) -> Word
fn digest(&self) -> Word
Returns a commitment to this Split node.
The commitment is computed as a hash of the on_true and on_false child nodes in the
domain defined by Self::DOMAIN - i..e,:
Hasher::merge_in_domain(&[on_true_digest, on_false_digest], SplitNode::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 = SplitNodeBuilder
type Builder = SplitNodeBuilder
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>
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>
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Source§fn append_children_to(&self, target: &mut Vec<MastNodeId>)
fn append_children_to(&self, target: &mut Vec<MastNodeId>)
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),
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)
impl Eq for SplitNode
impl StructuralPartialEq for SplitNode
Auto Trait Implementations§
impl Freeze for SplitNode
impl RefUnwindSafe for SplitNode
impl Send for SplitNode
impl Sync for SplitNode
impl Unpin for SplitNode
impl UnwindSafe for SplitNode
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)