about summary refs log tree commit diff
path: root/src/block/version.rs
blob: c52439c5d28fb8d965daaf5d42bf1460c2ce3ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::fmt;

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Version {
    Gif87a,
    Gif89a,
}

impl From<&Version> for &[u8] {
    fn from(version: &Version) -> Self {
        match version {
            Version::Gif87a => b"GIF87a",
            Version::Gif89a => b"GIF89a",
        }
    }
}

impl fmt::Display for Version {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Version::Gif87a => write!(f, "GIF87a"),
            Version::Gif89a => write!(f, "GIF89a"),
        }
    }
}