cairo_vm/types/
layout_name.rs1#[cfg(feature = "test_utils")]
2use arbitrary::{self, Arbitrary};
3#[cfg(all(feature = "clap", feature = "std"))]
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}
25
26impl LayoutName {
27 pub fn to_str(self) -> &'static str {
28 match self {
29 LayoutName::plain => "plain",
30 LayoutName::small => "small",
31 LayoutName::dex => "dex",
32 LayoutName::recursive => "recursive",
33 LayoutName::starknet => "starknet",
34 LayoutName::starknet_with_keccak => "starknet_with_keccak",
35 LayoutName::recursive_large_output => "recursive_large_output",
36 LayoutName::recursive_with_poseidon => "recursive_with_poseidon",
37 LayoutName::all_solidity => "all_solidity",
38 LayoutName::all_cairo => "all_cairo",
39 LayoutName::dynamic => "dynamic",
40 }
41 }
42}
43
44impl Display for LayoutName {
45 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46 self.to_str().fmt(f)
47 }
48}
49
50#[cfg(all(feature = "clap", feature = "std"))]
51impl ValueEnum for LayoutName {
52 fn value_variants<'a>() -> &'a [Self] {
53 &[
54 Self::plain,
55 Self::small,
56 Self::dex,
57 Self::recursive,
58 Self::starknet,
59 Self::starknet_with_keccak,
60 Self::recursive_large_output,
61 Self::recursive_with_poseidon,
62 Self::all_solidity,
63 Self::all_cairo,
64 Self::dynamic,
65 ]
66 }
67
68 fn to_possible_value(&self) -> Option<PossibleValue> {
69 Some(PossibleValue::new(self.to_str()))
70 }
71}