compiler_llvm_builder/
llvm_project.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9pub enum LLVMProject {
10 CLANG,
12 LLD,
14 LLDB,
16 MLIR,
18}
19
20impl std::str::FromStr for LLVMProject {
21 type Err = String;
22
23 fn from_str(value: &str) -> Result<Self, Self::Err> {
24 match value.to_lowercase().as_str() {
25 "clang" => Ok(Self::CLANG),
26 "lld" => Ok(Self::LLD),
27 "lldb" => Ok(Self::LLDB),
28 "mlir" => Ok(Self::MLIR),
29 value => Err(format!("Unsupported LLVM project to enable: `{}`", value)),
30 }
31 }
32}
33
34impl std::fmt::Display for LLVMProject {
35 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
36 match self {
37 Self::CLANG => write!(f, "clang"),
38 Self::LLD => write!(f, "lld"),
39 Self::LLDB => write!(f, "lldb"),
40 Self::MLIR => write!(f, "mlir"),
41 }
42 }
43}