mod builder;
pub use builder::*;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Default)]
#[serde(rename_all = "camelCase")]
pub enum EventDisplay {
#[default]
Auto,
Block,
ListItem,
Background,
InverseBackground,
None,
}
impl AsRef<str> for EventDisplay {
fn as_ref(&self) -> &str {
match self {
Self::Auto => "auto",
Self::Block => "block",
Self::ListItem => "listItem",
Self::Background => "background",
Self::InverseBackground => "inverse-background",
Self::None => "none",
}
}
}
impl std::str::FromStr for EventDisplay {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"auto" => Self::Auto,
"block" => Self::Block,
"listItem" => Self::ListItem,
"background" => Self::Background,
"inverse-background" => Self::InverseBackground,
"none" => Self::None,
s => return Err(format!("Invalid event display type: {s}")),
})
}
}