use core::fmt::Display;
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum FontStyle {
#[default]
Normal,
Italic,
Oblique,
}
impl Display for FontStyle {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
FontStyle::Normal => write!(f, "normal"),
FontStyle::Italic => write!(f, "italic"),
FontStyle::Oblique => write!(f, "oblique"),
}
}
}
#[cfg(test)]
mod tests {
use alloc::format;
use super::*;
#[test]
fn test_font_style_display() {
assert_eq!(format!("{}", FontStyle::Normal), "normal");
assert_eq!(format!("{}", FontStyle::Italic), "italic");
assert_eq!(format!("{}", FontStyle::Oblique), "oblique");
}
}