1use std::fmt;
2
3pub const PNG: &Format = &Format::Png;
4pub const PNG32: &Format = &Format::Png32;
5pub const GIF: &Format = &Format::Gif;
6pub const JPEG: &Format = &Format::Jpeg;
7pub const JPEG_BASELINE: &Format = &Format::JpegBaseline;
8
9#[derive(Clone, Copy)]
10pub enum Format {
11 Png,
12 Png32,
13 Gif,
14 Jpeg,
15 JpegBaseline,
16}
17
18impl fmt::Display for Format {
19 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20 write!(
21 f,
22 "{}",
23 match self {
24 Format::Png => "png",
25 Format::Png32 => "png32",
26 Format::Gif => "gif",
27 Format::Jpeg => "jpg",
28 Format::JpegBaseline => "jpg-baseline",
29 }
30 )
31 }
32}