#![allow(unused, clippy::match_single_binding)]
use std::fmt;
#[derive(Clone, Copy, PartialEq)]
pub struct Goal(pub u8);
impl Goal {
pub const TIME: Goal = Goal(0);
pub const DISTANCE: Goal = Goal(1);
pub const CALORIES: Goal = Goal(2);
pub const FREQUENCY: Goal = Goal(3);
pub const STEPS: Goal = Goal(4);
pub const ASCENT: Goal = Goal(5);
pub const ACTIVE_MINUTES: Goal = Goal(6);
}
impl Default for Goal {
fn default() -> Self {
Self(u8::MAX)
}
}
impl fmt::Display for Goal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
0 => write!(f, "time"),
1 => write!(f, "distance"),
2 => write!(f, "calories"),
3 => write!(f, "frequency"),
4 => write!(f, "steps"),
5 => write!(f, "ascent"),
6 => write!(f, "active_minutes"),
_ => write!(f, "Goal({})", self.0),
}
}
}
impl fmt::Debug for Goal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
0 => write!(f, "Goal::TIME(0)"),
1 => write!(f, "Goal::DISTANCE(1)"),
2 => write!(f, "Goal::CALORIES(2)"),
3 => write!(f, "Goal::FREQUENCY(3)"),
4 => write!(f, "Goal::STEPS(4)"),
5 => write!(f, "Goal::ASCENT(5)"),
6 => write!(f, "Goal::ACTIVE_MINUTES(6)"),
_ => write!(f, "Goal({})", self.0),
}
}
}