cat_dev/mion/proto/images/
mod.rs

1//! Protocols, and types specifically related to "IMAGES", or Disc Images for
2//! dealing with the MION.
3
4use std::fmt::{Display, Formatter, Result as FmtResult};
5use valuable::Valuable;
6
7#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Valuable)]
8pub enum MionDiscImageType {
9	WUMAD,
10	WUM,
11	Unknown(u8),
12}
13impl Display for MionDiscImageType {
14	fn fmt(&self, fmt: &mut Formatter<'_>) -> FmtResult {
15		match *self {
16			Self::WUMAD => write!(fmt, "WUMAD"),
17			Self::WUM => write!(fmt, "WUM/UNSET"),
18			Self::Unknown(val) => write!(fmt, "Unk({val})"),
19		}
20	}
21}
22impl From<u8> for MionDiscImageType {
23	fn from(value: u8) -> Self {
24		match value {
25			255 => MionDiscImageType::WUM,
26			254 => MionDiscImageType::WUMAD,
27			num => MionDiscImageType::Unknown(num),
28		}
29	}
30}
31impl From<MionDiscImageType> for u8 {
32	fn from(value: MionDiscImageType) -> u8 {
33		match value {
34			MionDiscImageType::WUM => 255,
35			MionDiscImageType::WUMAD => 254,
36			MionDiscImageType::Unknown(num) => num,
37		}
38	}
39}