cat-dev 0.0.13

A library for interacting with the CAT-DEV hardware units distributed by Nintendo (i.e. a type of Wii-U DevKits).
Documentation
//! Protocols, and types specifically related to "IMAGES", or Disc Images for
//! dealing with the MION.

use std::fmt::{Display, Formatter, Result as FmtResult};
use valuable::Valuable;

#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Valuable)]
pub enum MionDiscImageType {
	WUMAD,
	WUM,
	Unknown(u8),
}
impl Display for MionDiscImageType {
	fn fmt(&self, fmt: &mut Formatter<'_>) -> FmtResult {
		match *self {
			Self::WUMAD => write!(fmt, "WUMAD"),
			Self::WUM => write!(fmt, "WUM/UNSET"),
			Self::Unknown(val) => write!(fmt, "Unk({val})"),
		}
	}
}
impl From<u8> for MionDiscImageType {
	fn from(value: u8) -> Self {
		match value {
			255 => MionDiscImageType::WUM,
			254 => MionDiscImageType::WUMAD,
			num => MionDiscImageType::Unknown(num),
		}
	}
}
impl From<MionDiscImageType> for u8 {
	fn from(value: MionDiscImageType) -> u8 {
		match value {
			MionDiscImageType::WUM => 255,
			MionDiscImageType::WUMAD => 254,
			MionDiscImageType::Unknown(num) => num,
		}
	}
}