sway_core/asm_generation/
instruction_set.rs1use crate::asm_lang::allocated_ops::AllocatedOp;
2use std::fmt;
3
4#[derive(Clone)]
6pub enum InstructionSet {
7 Fuel { ops: Vec<AllocatedOp> },
8 Evm { ops: Vec<etk_asm::ops::AbstractOp> },
9}
10
11impl fmt::Display for InstructionSet {
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 write!(
14 f,
15 ".program:\n{}",
16 match self {
17 InstructionSet::Fuel { ops } => ops
18 .iter()
19 .map(|x| format!("{x}"))
20 .collect::<Vec<_>>()
21 .join("\n"),
22 InstructionSet::Evm { ops } => ops
23 .iter()
24 .map(|x| format!("{x}"))
25 .collect::<Vec<_>>()
26 .join("\n"),
27 }
28 )
29 }
30}