zksync_error/
kind.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// AUTOGENERATED BASED ON A SET OF JSON FILES, DO NOT EDIT MANUALLY
//
use crate::error::domains::AnvilZksyncCode;
use crate::error::domains::CompilerCode;
use crate::error::domains::CoreCode;
use crate::error::domains::FoundryCode;
use crate::error::domains::HardhatCode;
use strum_macros::EnumDiscriminants;
use strum_macros::FromRepr;
#[derive(
    Clone, Debug, EnumDiscriminants, Eq, PartialEq, serde :: Deserialize, serde :: Serialize,
)]
#[strum_discriminants(name(DomainCode))]
#[strum_discriminants(derive(FromRepr))]
#[strum_discriminants(vis(pub))]
#[repr(u32)]
pub enum Kind {
    AnvilZksync(AnvilZksyncCode) = 5u32,
    Compiler(CompilerCode) = 2u32,
    Core(CoreCode) = 1u32,
    Foundry(FoundryCode) = 4u32,
    Hardhat(HardhatCode) = 3u32,
}
impl Kind {
    pub fn domain_code(&self) -> u32 {
        let domain: DomainCode = self.clone().into();
        domain as u32
    }
    pub fn component_code(&self) -> u32 {
        match self {
            Kind::AnvilZksync(component) => *component as u32,
            Kind::Compiler(component) => *component as u32,
            Kind::Core(component) => *component as u32,
            Kind::Foundry(component) => *component as u32,
            Kind::Hardhat(component) => *component as u32,
        }
    }
}