miden_assembly_syntax/ast/instruction/
advice.rs1use core::fmt;
2
3use miden_core::sys_events::SystemEvent;
4
5#[derive(Clone, PartialEq, Eq, Debug)]
14pub enum SystemEventNode {
15 PushU64Div,
16 PushFalconDiv,
17 PushSmtPeek,
18 PushMapVal,
19 PushMapValN,
20 HasMapKey,
21 PushMtNode,
22 InsertMem,
23 InsertHdword,
24 InsertHdwordWithDomain,
25 InsertHperm,
26}
27
28impl From<&SystemEventNode> for SystemEvent {
29 fn from(value: &SystemEventNode) -> Self {
30 use SystemEventNode::*;
31 match value {
32 PushU64Div => Self::U64Div,
33 PushFalconDiv => Self::FalconDiv,
34 PushSmtPeek => Self::SmtPeek,
35 PushMapVal => Self::MapValueToStack,
36 PushMapValN => Self::MapValueToStackN,
37 HasMapKey => Self::HasMapKey,
38 PushMtNode => Self::MerkleNodeToStack,
39 InsertMem => Self::MemToMap,
40 InsertHdword => Self::HdwordToMap,
41 InsertHdwordWithDomain => Self::HdwordToMapWithDomain,
42 InsertHperm => Self::HpermToMap,
43 }
44 }
45}
46
47impl crate::prettier::PrettyPrint for SystemEventNode {
48 fn render(&self) -> crate::prettier::Document {
49 crate::prettier::display(self)
50 }
51}
52
53impl fmt::Display for SystemEventNode {
54 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
55 match self {
56 Self::PushU64Div => write!(f, "push_u64div"),
57 Self::PushFalconDiv => write!(f, "push_falcon_div"),
58 Self::PushSmtPeek => write!(f, "push_smtpeek"),
59 Self::PushMapVal => write!(f, "push_mapval"),
60 Self::PushMapValN => write!(f, "push_mapvaln"),
61 Self::HasMapKey => write!(f, "has_mapkey"),
62 Self::PushMtNode => write!(f, "push_mtnode"),
63 Self::InsertMem => write!(f, "insert_mem"),
64 Self::InsertHdword => write!(f, "insert_hdword"),
65 Self::InsertHdwordWithDomain => write!(f, "insert_hdword_d"),
66 Self::InsertHperm => writeln!(f, "insert_hperm"),
67 }
68 }
69}