diff --git a/src/commands.rs b/src/commands.rs index 7a8cc12..9015334 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -1,7 +1,7 @@ use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; #[derive(Debug)] -enum Weekday { +pub enum Weekday { Monday, Tuesday, Wednesday, @@ -12,7 +12,7 @@ enum Weekday { } #[derive(Debug)] -enum DeltaStep { +pub enum DeltaStep { /// `y`, move by a year, keeping the same month and day Year(i32), /// `m`, move by a month, keeping the same day `d` @@ -44,37 +44,37 @@ pub struct Delta { } #[derive(Debug)] -struct DateEndSpec { - end: Option, - delta: Option, - end_time: Option, +pub struct DateEndSpec { + pub end: Option, + pub delta: Option, + pub end_time: Option, } #[derive(Debug)] -struct DateSpec { - start: NaiveDate, - delta: Option, - start_time: Option, - end: Option, - repeat: Option, +pub struct DateSpec { + pub start: NaiveDate, + pub delta: Option, + pub start_time: Option, + pub end: Option, + pub repeat: Option, } #[derive(Debug)] -struct WeekdayEndSpec { - end: Option, - delta: Option, - end_time: Option, +pub struct WeekdayEndSpec { + pub end: Option, + pub delta: Option, + pub end_time: Option, } #[derive(Debug)] -struct WeekdaySpec { - start: Weekday, - start_time: Option, - end: Option, +pub struct WeekdaySpec { + pub start: Weekday, + pub start_time: Option, + pub end: Option, } #[derive(Debug)] -enum IntVar { +pub enum IntVar { /// `j`, see https://en.wikipedia.org/wiki/Julian_day JulianDay, /// `y` @@ -142,7 +142,7 @@ enum IntVar { } #[derive(Debug)] -enum IntExpr { +pub enum IntExpr { Lit(i64), Var(IntVar), Paren(Box), @@ -156,7 +156,7 @@ enum IntExpr { } #[derive(Debug)] -enum BoolVar { +pub enum BoolVar { /// `isWeekday`, whether the current day is one of mon-fri IsWeekday, /// `isWeekend`, whether the current day is one of sat-sun @@ -166,7 +166,7 @@ enum BoolVar { } #[derive(Debug)] -enum BoolExpr { +pub enum BoolExpr { Lit(bool), Var(BoolVar), Paren(Box), @@ -185,56 +185,56 @@ enum BoolExpr { } #[derive(Debug)] -struct FormulaSpec { - start: Option, // None: * - start_time: Option, - offset: Option, - end: Option, +pub struct FormulaSpec { + pub start: Option, // None: * + pub start_time: Option, + pub offset: Option, + pub end: Option, } #[derive(Debug)] -enum Spec { +pub enum Spec { Date(DateSpec), Weekday(WeekdaySpec), Formula(FormulaSpec), } #[derive(Debug)] -struct Done { - refering_to: Option, - created_at: Option, +pub struct Done { + pub refering_to: Option, + pub created_at: Option, } #[derive(Debug)] -struct Task { - title: String, - when: Vec, - done: Vec, - desc: Option, +pub struct Task { + pub title: String, + pub when: Vec, + pub done: Vec, + pub desc: Option, } #[derive(Debug)] -struct Note { - title: String, - when: Vec, // Not empty - desc: Option, +pub struct Note { + pub title: String, + pub when: Vec, // Should not be empty? + pub desc: Option, } #[derive(Debug)] -struct BirthdaySpec { - date: NaiveDate, - year_known: bool, // If year is unknown, use NaiveDate of year 0 +pub struct BirthdaySpec { + pub date: NaiveDate, + pub year_known: bool, // If year is unknown, use NaiveDate of year 0 } #[derive(Debug)] -struct Birthday { - title: String, - when: BirthdaySpec, - desc: Option, +pub struct Birthday { + pub title: String, + pub when: BirthdaySpec, + pub desc: Option, } #[derive(Debug)] -enum Command { +pub enum Command { Task(Task), Note(Note), Birthday(Birthday),