compiler_llvm_builder/
target_triple.rs

1//!
2//! The ZKsync LLVM target triples.
3//!
4
5///
6/// The list of target triples used as constants.
7///
8/// It must be in the lowercase.
9///
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
11pub enum TargetTriple {
12    /// The EraVM back end developed by Matter Labs.
13    EraVM,
14    /// The EVM back end developed by Matter Labs.
15    EVM,
16}
17
18impl std::str::FromStr for TargetTriple {
19    type Err = String;
20
21    fn from_str(value: &str) -> Result<Self, Self::Err> {
22        match value {
23            "eravm" => Ok(Self::EraVM),
24            "evm" => Ok(Self::EVM),
25            value => Err(format!("Unsupported target triple: `{}`", value)),
26        }
27    }
28}
29
30impl std::fmt::Display for TargetTriple {
31    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32        match self {
33            Self::EraVM => write!(f, "eravm"),
34            Self::EVM => write!(f, "evm"),
35        }
36    }
37}