cairo_vm/types/
layout_name.rs1#[cfg(feature = "test_utils")]
2use arbitrary::{self, Arbitrary};
3#[cfg(feature = "clap")]
4use clap::{builder::PossibleValue, ValueEnum};
5use core::fmt::{self, Display};
6use serde::{Deserialize, Serialize};
7
8#[cfg_attr(feature = "test_utils", derive(Arbitrary))]
10#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone, Eq, Hash)]
11#[allow(non_camel_case_types)]
12pub enum LayoutName {
13 plain,
14 small,
15 dex,
16 recursive,
17 starknet,
18 starknet_with_keccak,
19 recursive_large_output,
20 recursive_with_poseidon,
21 all_solidity,
22 all_cairo,
23 dynamic,
24 all_cairo_stwo,
25 stwo_no_ecop,
26 perpetual,
27 dex_with_bitwise,
28}
29
30impl LayoutName {
31 pub fn to_str(self) -> &'static str {
32 match self {
33 LayoutName::plain => "plain",
34 LayoutName::small => "small",
35 LayoutName::dex => "dex",
36 LayoutName::recursive => "recursive",
37 LayoutName::starknet => "starknet",
38 LayoutName::starknet_with_keccak => "starknet_with_keccak",
39 LayoutName::recursive_large_output => "recursive_large_output",
40 LayoutName::recursive_with_poseidon => "recursive_with_poseidon",
41 LayoutName::all_solidity => "all_solidity",
42 LayoutName::all_cairo => "all_cairo",
43 LayoutName::dynamic => "dynamic",
44 LayoutName::all_cairo_stwo => "all_cairo_stwo",
45 LayoutName::stwo_no_ecop => "stwo_no_ecop",
46 LayoutName::perpetual => "perpetual",
47 LayoutName::dex_with_bitwise => "dex_with_bitwise",
48 }
49 }
50}
51
52impl Display for LayoutName {
53 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54 self.to_str().fmt(f)
55 }
56}
57
58#[cfg(feature = "clap")]
59impl ValueEnum for LayoutName {
60 fn value_variants<'a>() -> &'a [Self] {
61 &[
62 Self::plain,
63 Self::small,
64 Self::dex,
65 Self::recursive,
66 Self::starknet,
67 Self::starknet_with_keccak,
68 Self::recursive_large_output,
69 Self::recursive_with_poseidon,
70 Self::all_solidity,
71 Self::all_cairo,
72 Self::dynamic,
73 Self::all_cairo_stwo,
74 Self::stwo_no_ecop,
75 Self::perpetual,
76 Self::dex_with_bitwise,
77 ]
78 }
79
80 fn to_possible_value(&self) -> Option<PossibleValue> {
81 Some(PossibleValue::new(self.to_str()))
82 }
83}