Sfoglia il codice sorgente

Merge the two `impl` blocks for PNGImage

Lucas Stadler 11 anni fa
parent
commit
b030f12a8e
1 ha cambiato i file con 4 aggiunte e 6 eliminazioni
  1. 4 6
      rust/coffi/src/main.rs

+ 4 - 6
rust/coffi/src/main.rs

26
        return img
26
        return img
27
    }
27
    }
28
28
29
    fn begin_read_from_file(&mut self, file_name: *const libc::c_char) -> u32 {
30
        unsafe { png_image_begin_read_from_file(self, file_name) as u32 }
31
    }
32
}
33
34
impl PNGImage {
35
    fn message(&self) -> String {
29
    fn message(&self) -> String {
36
        String::from_utf8(self.message.iter().map(|&c| c as u8).collect()).unwrap()
30
        String::from_utf8(self.message.iter().map(|&c| c as u8).collect()).unwrap()
37
    }
31
    }
32
33
    fn begin_read_from_file(&mut self, file_name: *const libc::c_char) -> u32 {
34
        unsafe { png_image_begin_read_from_file(self, file_name) as u32 }
35
    }
38
}
36
}
39
37
40
impl std::fmt::Display for PNGImage {
38
impl std::fmt::Display for PNGImage {