revive_llvm_builder/
build_type.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum BuildType {
6 Debug,
8 Release,
10 RelWithDebInfo,
12 MinSizeRel,
14}
15
16impl std::str::FromStr for BuildType {
17 type Err = String;
18
19 fn from_str(value: &str) -> Result<Self, Self::Err> {
20 match value {
21 "Debug" => Ok(Self::Debug),
22 "Release" => Ok(Self::Release),
23 "RelWithDebInfo" => Ok(Self::RelWithDebInfo),
24 "MinSizeRel" => Ok(Self::MinSizeRel),
25 value => Err(format!("Unsupported build type: `{value}`")),
26 }
27 }
28}
29
30impl std::fmt::Display for BuildType {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 match self {
33 Self::Debug => write!(f, "Debug"),
34 Self::Release => write!(f, "Release"),
35 Self::RelWithDebInfo => write!(f, "RelWithDebInfo"),
36 Self::MinSizeRel => write!(f, "MinSizeRel"),
37 }
38 }
39}