yew_full_calendar/events/
mod.rs1mod builder;
2
3pub use builder::*;
4
5#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Default)]
6#[serde(rename_all = "camelCase")]
7pub enum EventDisplay {
8 #[default]
9 Auto,
10 Block,
11 ListItem,
12 Background,
13 InverseBackground,
14 None,
15}
16impl AsRef<str> for EventDisplay {
17 fn as_ref(&self) -> &str {
18 match self {
19 Self::Auto => "auto",
20 Self::Block => "block",
21 Self::ListItem => "listItem",
22 Self::Background => "background",
23 Self::InverseBackground => "inverse-background",
24 Self::None => "none",
25 }
26 }
27}
28impl std::str::FromStr for EventDisplay {
29 type Err = String;
30 fn from_str(s: &str) -> Result<Self, Self::Err> {
31 Ok(match s {
32 "auto" => Self::Auto,
33 "block" => Self::Block,
34 "listItem" => Self::ListItem,
35 "background" => Self::Background,
36 "inverse-background" => Self::InverseBackground,
37 "none" => Self::None,
38 s => return Err(format!("Invalid event display type: {s}")),
39 })
40 }
41}
42