Refactored modules
This commit is contained in:
parent
65a7670a1b
commit
7e3bccb5ad
9 changed files with 37 additions and 23 deletions
20
src/task.rs
Normal file
20
src/task.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
pub type TaskId = String; // This is an HTML "etag"
|
||||
|
||||
/// A to-do task
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Task {
|
||||
id: TaskId,
|
||||
name: String,
|
||||
completed: bool,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
pub fn id(&self) -> &TaskId { &self.id }
|
||||
pub fn name(&self) -> &str { &self.name }
|
||||
pub fn completed(&self) -> bool { self.completed }
|
||||
|
||||
pub fn set_completed(&mut self) {
|
||||
// TODO: either require a reference to the DataSource, so that it is aware
|
||||
// or change a flag here, and the DataSource will be able to check the flags of all its content (but then the Calendar should only give a reference/Arc, not a clone)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue