RBE hello/print/fmt activity
This commit is contained in:
parent
8f891c1e73
commit
60da2e20dc
@ -30,6 +30,16 @@ struct Color {
|
|||||||
blue: u8,
|
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() {
|
fn main() {
|
||||||
for city in [
|
for city in [
|
||||||
City {
|
City {
|
||||||
@ -72,6 +82,6 @@ fn main() {
|
|||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
{
|
{
|
||||||
println!("{:?}", *color);
|
println!("{}", *color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user