system: implement Display

This commit is contained in:
Graham Christensen 2019-11-02 18:24:24 +01:00
parent 7bde2652e4
commit 116cbddf7a
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
3 changed files with 7 additions and 7 deletions

View file

@ -244,5 +244,4 @@ baz",
parse("@ofborg build foo bar baz.Baz")
);
}
}

View file

@ -191,5 +191,4 @@ gnome3.evolution_data_server.aarch64-linux /nix/
);
assert_eq!(parse_lines(&mut Cursor::new(TEST_LINES)), expect);
}
}

View file

@ -5,15 +5,17 @@ pub enum System {
X8664Darwin,
}
impl System {
pub fn to_string(&self) -> String {
impl std::fmt::Display for System {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
System::X8664Linux => String::from("x86_64-linux"),
System::Aarch64Linux => String::from("aarch64-linux"),
System::X8664Darwin => String::from("x86_64-darwin"),
System::X8664Linux => write!(f, "x86_64-linux"),
System::Aarch64Linux => write!(f, "aarch64-linux"),
System::X8664Darwin => write!(f, "x86_64-darwin"),
}
}
}
impl System {
pub fn as_build_destination(&self) -> (Option<String>, Option<String>) {
(None, Some(format!("build-inputs-{}", self.to_string())))
}