diff options
Diffstat (limited to 'src/block/version.rs')
-rw-r--r-- | src/block/version.rs | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/block/version.rs b/src/block/version.rs index a5d688d..b785f27 100644 --- a/src/block/version.rs +++ b/src/block/version.rs @@ -1,13 +1,24 @@ +use std::fmt; + pub enum Version { - Gif87a, - Gif89a + Gif87a, + Gif89a, } impl From<&Version> for &[u8] { - fn from(version: &Version) -> Self { - match version { - Version::Gif87a => b"GIF87a", - Version::Gif89a => b"GIF89a" - } - } -} \ No newline at end of file + 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"), + } + } +} |