compiler_llvm_builder/
build_type.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9pub enum BuildType {
10 Debug,
12 Release,
14 RelWithDebInfo,
16 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}