12345678910111213141516171819202122232425262728293031323334353637 |
- use failure::Error;
- use std::str::FromStr;
- #[derive(Debug, PartialEq, Eq)]
- pub enum Team {
- Libs,
- Compiler,
- Lang,
- }
- impl Team {
- pub fn label(&self) -> crate::github::Label {
- match self {
- Team::Libs => crate::github::Label {
- name: String::from("T-libs"),
- },
- Team::Compiler => crate::github::Label {
- name: String::from("T-compiler"),
- },
- Team::Lang => crate::github::Label {
- name: String::from("T-lang"),
- },
- }
- }
- }
- impl FromStr for Team {
- type Err = Error;
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- Ok(match s {
- "libs" => Team::Libs,
- "compiler" => Team::Compiler,
- "lang" => Team::Lang,
- _ => failure::bail!("unknown team: {:?}", s),
- })
- }
- }
|