Просмотр исходного кода

Merge the two `impl` blocks for PNGImage

Lucas Stadler лет назад: 10
Родитель
Сommit
b030f12a8e
1 измененных файлов с 4 добавлено и 6 удалено
  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 {