era_compiler_common/
code_segment.rs

1//!
2//! The contract code segment.
3//!
4
5///
6/// The contract code segment.
7///
8/// On EraVM, the segments do not represent any entities in the final bytecode, but this separation is present
9/// in IRs used for lowering.
10///
11/// On EVM, the segments represent deploy and runtime code segments without changes.
12///
13#[derive(
14    Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
15)]
16#[serde(rename_all = "camelCase")]
17pub enum CodeSegment {
18    /// The deploy code segment.
19    Deploy,
20    /// The runtime code segment.
21    Runtime,
22}
23
24impl std::fmt::Display for CodeSegment {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        match self {
27            Self::Deploy => write!(f, "deploy"),
28            Self::Runtime => write!(f, "runtime"),
29        }
30    }
31}