Stub rescheduling algo
This commit is contained in:
parent
b3e0270e38
commit
adc6b7866a
4 changed files with 186 additions and 12 deletions
40
src/task.rs
40
src/task.rs
|
|
@ -1,5 +1,43 @@
|
|||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Task {
|
||||
/// Issue Number for referencing the task
|
||||
pub issue_number: u64,
|
||||
|
||||
/// Human-readable summary of the task
|
||||
pub title: String,
|
||||
|
||||
/// Whether the task is open or has been completed
|
||||
pub state: State,
|
||||
|
||||
/// Whether the task is a recurring one and metadata for rescheduling
|
||||
pub recurring: Option<Recurring>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum State {
|
||||
/// The task is open and pending completion.
|
||||
///
|
||||
/// An optional due date may be present.
|
||||
Open { due: Option<time::OffsetDateTime> },
|
||||
|
||||
/// The task has been completed at the specified time.
|
||||
Completed { date: time::OffsetDateTime },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Recurring {
|
||||
pub interval: RecurringInterval,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum RecurringInterval {
|
||||
Months(u32),
|
||||
Weeks(u32),
|
||||
Days(u32),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Task {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "#{} — \"{}\"", self.issue_number, self.title)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue