oc2_hlapi_v2 0.2.0

A client for the new version of OpenComputers II's HLAPI
Documentation
use std::fmt::Display;

use num_enum::{IntoPrimitive, TryFromPrimitive};
use serde::{Deserialize, Serialize};

/// A Minecraft color
#[derive(
    Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, IntoPrimitive, TryFromPrimitive, Hash,
)]
#[repr(u8)]
#[allow(missing_docs)] // This enum's variants are self-documenting
#[serde(rename_all = "snake_case")]
pub enum Color {
    White = 0,
    Orange = 1,
    Magenta = 2,
    LightBlue = 3,
    Yellow = 4,
    Lime = 5,
    Pink = 6,
    Gray = 7,
    LightGray = 8,
    Cyan = 9,
    Purple = 10,
    Blue = 11,
    Brown = 12,
    Green = 13,
    Red = 14,
    Black = 15,
}

impl Display for Color {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::White => f.write_str("white"),
            Self::Orange => f.write_str("orange"),
            Self::Magenta => f.write_str("magenta"),
            Self::LightBlue => f.write_str("light blue"),
            Self::Yellow => f.write_str("yellow"),
            Self::Lime => f.write_str("lime"),
            Self::Pink => f.write_str("pink"),
            Self::Gray => f.write_str("gray"),
            Self::LightGray => f.write_str("light gray"),
            Self::Cyan => f.write_str("cyan"),
            Self::Purple => f.write_str("purple"),
            Self::Blue => f.write_str("blue"),
            Self::Brown => f.write_str("brown"),
            Self::Green => f.write_str("green"),
            Self::Red => f.write_str("red"),
            Self::Black => f.write_str("black"),
        }
    }
}