task_hookrs/
status.rs

1//
2// This Source Code Form is subject to the terms of the Mozilla Public
3// License, v. 2.0. If a copy of the MPL was not distributed with this
4// file, You can obtain one at http://mozilla.org/MPL/2.0/.
5//
6
7//! Module containing `TaskStatus` type and trait impls
8
9use std::fmt::{Display, Error as FmtError, Formatter};
10
11/// Enum for status taskwarrior supports.
12#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
13pub enum TaskStatus {
14    /// Pending status type
15    #[serde(rename = "pending")]
16    Pending,
17
18    /// Deleted status type
19    #[serde(rename = "deleted")]
20    Deleted,
21
22    /// Completed status type
23    #[serde(rename = "completed")]
24    Completed,
25
26    /// Waiting status type
27    #[serde(rename = "waiting")]
28    Waiting,
29
30    /// Recurring status type
31    #[serde(rename = "recurring")]
32    Recurring,
33}
34
35impl Display for TaskStatus {
36    fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
37        match self {
38            TaskStatus::Pending => write!(fmt, "Pending"),
39            TaskStatus::Deleted => write!(fmt, "Deleted"),
40            TaskStatus::Completed => write!(fmt, "Completed"),
41            TaskStatus::Waiting => write!(fmt, "Waiting"),
42            TaskStatus::Recurring => write!(fmt, "Recurring"),
43        }
44    }
45}