use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
#[derive(Debug, PartialEq, Eq)]
pub enum CaesuraValue {
Normal,
Thick,
Short,
Curved,
Single,
Empty,
}
impl DatatypeSerializer for CaesuraValue {
fn serialize(element: &Self) -> String {
match element {
Self::Normal => String::from("normal"),
Self::Thick => String::from("thick"),
Self::Short => String::from("short"),
Self::Curved => String::from("curved"),
Self::Single => String::from("single"),
Self::Empty => String::new(),
}
}
}
impl DatatypeDeserializer for CaesuraValue {
fn deserialize(value: &str) -> Result<Self, String> {
Ok(match value {
"normal" => Self::Normal,
"thick" => Self::Thick,
"short" => Self::Short,
"curved" => Self::Curved,
"single" => Self::Single,
_ => Self::Empty,
})
}
}