|
|
@ -31,15 +31,17 @@ impl PNGImage {
|
|
31
|
31
|
}
|
|
32
|
32
|
}
|
|
33
|
33
|
|
|
|
34
|
impl PNGImage {
|
|
|
35
|
fn message(&self) -> String {
|
|
|
36
|
String::from_utf8(self.message.iter().map(|&c| c as u8).collect()).unwrap()
|
|
|
37
|
}
|
|
|
38
|
}
|
|
|
39
|
|
|
34
|
40
|
impl std::fmt::Display for PNGImage {
|
|
35
|
41
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
36
|
|
fn get_message(msg: [libc::c_char; 64]) -> String {
|
|
37
|
|
String::from_utf8(msg.iter().map(|&c| c as u8).collect()).unwrap()
|
|
38
|
|
}
|
|
39
|
|
|
|
40
|
42
|
write!(f, "{}x{} {} {} {} {} {} {}", self.width, self.height, self.version,
|
|
41
|
43
|
self.format, self.flags, self.colormap_entries, self.warning_or_error,
|
|
42
|
|
get_message(self.message))
|
|
|
44
|
self.message())
|
|
43
|
45
|
}
|
|
44
|
46
|
}
|
|
45
|
47
|
|