compiler_llvm_builder/platforms/
mod.rs

1//!
2//! The ZKsync LLVM builder platforms.
3//!
4
5pub mod aarch64_linux_gnu;
6pub mod aarch64_linux_musl;
7pub mod aarch64_macos;
8pub mod shared;
9pub mod x86_64_linux_gnu;
10pub mod x86_64_linux_musl;
11pub mod x86_64_macos;
12pub mod x86_64_windows_gnu;
13
14use std::str::FromStr;
15
16///
17/// The list of platforms used as constants.
18///
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
20pub enum Platform {
21    /// The native X86 platform.
22    X86,
23    /// The native AArch64 platform.
24    AArch64,
25    /// The EraVM back end developed by Matter Labs.
26    EraVM,
27    /// The EVM back end developed by Matter Labs.
28    EVM,
29}
30
31impl FromStr for Platform {
32    type Err = String;
33
34    fn from_str(value: &str) -> Result<Self, Self::Err> {
35        match value {
36            "EraVM" => Ok(Self::EraVM),
37            "EVM" => Ok(Self::EVM),
38            value => Err(format!("Unsupported platform: `{}`", value)),
39        }
40    }
41}
42
43impl std::fmt::Display for Platform {
44    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
45        match self {
46            Self::X86 => write!(f, "X86"),
47            Self::AArch64 => write!(f, "AArch64"),
48            Self::EraVM => write!(f, "EraVM"),
49            Self::EVM => write!(f, "EVM"),
50        }
51    }
52}