compiler_llvm_builder/
build_type.rs

1//!
2//! The ZKsync LLVM build type.
3//!
4
5///
6/// The ZKsync LLVM build type.
7///
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9pub enum BuildType {
10    /// The debug build.
11    Debug,
12    /// The release build.
13    Release,
14    /// The release with debug info build.
15    RelWithDebInfo,
16    /// The minimal size release build.
17    MinSizeRel,
18}
19
20impl std::str::FromStr for BuildType {
21    type Err = String;
22
23    fn from_str(value: &str) -> Result<Self, Self::Err> {
24        match value {
25            "Debug" => Ok(Self::Debug),
26            "Release" => Ok(Self::Release),
27            "RelWithDebInfo" => Ok(Self::RelWithDebInfo),
28            "MinSizeRel" => Ok(Self::MinSizeRel),
29            value => Err(format!("Unsupported build type: `{}`", value)),
30        }
31    }
32}
33
34impl std::fmt::Display for BuildType {
35    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36        match self {
37            Self::Debug => write!(f, "Debug"),
38            Self::Release => write!(f, "Release"),
39            Self::RelWithDebInfo => write!(f, "RelWithDebInfo"),
40            Self::MinSizeRel => write!(f, "MinSizeRel"),
41        }
42    }
43}