team.rs 864 B

123456789101112131415161718192021222324252627282930313233343536
  1. use std::str::FromStr;
  2. #[derive(Debug, PartialEq, Eq)]
  3. pub enum Team {
  4. Libs,
  5. Compiler,
  6. Lang,
  7. }
  8. impl Team {
  9. pub fn label(&self) -> crate::github::Label {
  10. match self {
  11. Team::Libs => crate::github::Label {
  12. name: String::from("T-libs"),
  13. },
  14. Team::Compiler => crate::github::Label {
  15. name: String::from("T-compiler"),
  16. },
  17. Team::Lang => crate::github::Label {
  18. name: String::from("T-lang"),
  19. },
  20. }
  21. }
  22. }
  23. impl FromStr for Team {
  24. type Err = anyhow::Error;
  25. fn from_str(s: &str) -> Result<Self, Self::Err> {
  26. Ok(match s {
  27. "libs" => Team::Libs,
  28. "compiler" => Team::Compiler,
  29. "lang" => Team::Lang,
  30. _ => anyhow::bail!("unknown team: {:?}", s),
  31. })
  32. }
  33. }