Activity for 1.2.3

This commit is contained in:
Dan Buch 2016-08-31 11:48:09 -04:00
parent cb36ed01b2
commit 0d0edf5629
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

View File

@ -23,6 +23,13 @@ struct Color {
blue: u8,
}
impl Display for Color {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "RGB ({}, {}, {}) 0x{:02X}{:02X}{:02X}", self.red, self.green, self.blue, self.red, self.green, self.blue)
}
}
fn main() {
for city in [
City { name: "Dublin", lat: 53.347778, lon: -6.259722 },
@ -38,5 +45,6 @@ fn main() {
Color { red: 0, green: 0, blue: 0 },
].iter() {
println!("{:?}", *color);
println!("{}", *color);
}
}