o i am too structured huh
parent
ad9c32c987
commit
5a75b3e5f2
|
|
@ -1,3 +1,27 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
println!("{:?}", Task{todo: "x".to_string(), when: None, detail: None, sub: vec![]})
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Task {
|
||||
pub todo: String,
|
||||
pub when: Option<When>,
|
||||
pub detail: Option<String>,
|
||||
pub sub: Vec<Task>,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
fn is_due(&self) -> bool {
|
||||
self.when.is_none() || self.when.clone().unwrap().is_due()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct When(String);
|
||||
|
||||
impl When {
|
||||
fn is_due(&self) -> bool {
|
||||
assert!(false);
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue