1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-22 08:14:18 +00:00

Derive defaults for TaskIcon, TaskImportance, TaskPriority, and v1::TaskStatus

This commit is contained in:
Steffo 2023-09-29 09:42:15 +02:00
parent 352c8378d0
commit a0342d9aa8

View file

@ -36,7 +36,7 @@ pub struct Task {
} }
/// Possible icons for a [`Task`]. /// Possible icons for a [`Task`].
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub enum TaskIcon { pub enum TaskIcon {
User, User,
Image, Image,
@ -54,61 +54,37 @@ pub enum TaskIcon {
Handshake, Handshake,
Sun, Sun,
Clock, Clock,
Circle, #[default] Circle,
Square, Square,
Building, Building,
Flag, Flag,
Moon, Moon,
} }
impl Default for TaskIcon {
fn default() -> Self {
TaskIcon::Circle
}
}
/// The importance of a [`Task`] (how much it matters). /// The importance of a [`Task`] (how much it matters).
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
pub enum TaskImportance { pub enum TaskImportance {
Highest, Highest,
High, High,
Normal, #[default] Normal,
Low, Low,
Lowest, Lowest,
} }
impl Default for TaskImportance {
fn default() -> Self {
TaskImportance::Normal
}
}
/// The priority of a [`Task`] (how soon it should be completed). /// The priority of a [`Task`] (how soon it should be completed).
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
pub enum TaskPriority { pub enum TaskPriority {
Highest, Highest,
High, High,
Normal, #[default] Normal,
Low, Low,
Lowest, Lowest,
} }
impl Default for TaskPriority {
fn default() -> Self {
TaskPriority::Normal
}
}
/// The status a [`Task`] is currently in. /// The status a [`Task`] is currently in.
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
pub enum TaskStatus { pub enum TaskStatus {
Unfinished, #[default] Unfinished,
InProgress, InProgress,
Complete, Complete,
} }
impl Default for TaskStatus {
fn default() -> Self {
TaskStatus::Unfinished
}
}