56 lines
1.3 KiB
Rust
56 lines
1.3 KiB
Rust
#[derive(serde::Deserialize, serde::Serialize, Debug, PartialEq, Eq)]
|
|
pub enum DanceRole {
|
|
Leader,
|
|
Follower,
|
|
}
|
|
|
|
impl DanceRole {
|
|
#[allow(dead_code)]
|
|
pub const fn other(&self) -> Self {
|
|
match self {
|
|
Self::Leader => Self::Follower,
|
|
Self::Follower => Self::Leader,
|
|
}
|
|
}
|
|
}
|
|
|
|
serde_plain::derive_display_from_serialize!(DanceRole);
|
|
serde_plain::derive_fromstr_from_deserialize!(DanceRole);
|
|
|
|
#[derive(
|
|
serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy,
|
|
)]
|
|
pub enum DanceRank {
|
|
Newcomer,
|
|
Novice,
|
|
Intermediate,
|
|
#[serde(rename = "Advance", alias = "Advanced")]
|
|
Advanced,
|
|
#[serde(rename = "All Star", alias = "All-Stars")]
|
|
AllStars,
|
|
Champions,
|
|
}
|
|
serde_plain::derive_display_from_serialize!(DanceRank);
|
|
serde_plain::derive_fromstr_from_deserialize!(DanceRank);
|
|
|
|
#[derive(Debug)]
|
|
pub struct CompState {
|
|
pub rank: DanceRank,
|
|
pub points: u16,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct DanceInfo {
|
|
pub firstname: String,
|
|
pub lastname: String,
|
|
pub dominant_role: DanceRole,
|
|
pub dominant_role_comp: CompState,
|
|
pub non_dominant_role_comp: Option<CompState>,
|
|
}
|
|
|
|
impl DanceInfo {
|
|
pub fn name(&self) -> String {
|
|
format!("{} {}", self.firstname, self.lastname)
|
|
}
|
|
}
|