diff options
author | Imran Iqbal <imran@imraniqbal.org> | 2022-12-27 16:38:20 -0500 |
---|---|---|
committer | Imran Iqbal <imran@imraniqbal.org> | 2022-12-29 13:28:50 -0500 |
commit | 14592e2cf4d5a5589971847e2d6ebad94e227504 (patch) | |
tree | b4fc67dfa3ec73950d4f7d0df63e5ad342b6098f /examples/import_task.rs | |
parent | 15e3895e6f7af0a9fdf3c6bb7e8c3131a3e81fa8 (diff) |
Support taskwarrior 2.6.0 serialization format
As of taskwarrior 2.6.0 the depends field changed from being a string of
comma seperated uuid's to being a proper json array of uuid strings.
This commit allows the selection of which serialization format to use
with the help of typestating. Task<TW26> will (de)serialize to the new format,
while Task<TW25> will retain the older behaviour. This will allow this
library to be used with any version of taskwarrior.
Signed-off-by: Imran Iqbal <imran@imraniqbal.org>
Diffstat (limited to 'examples/import_task.rs')
-rw-r--r-- | examples/import_task.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/import_task.rs b/examples/import_task.rs index c806bf6..11622d2 100644 --- a/examples/import_task.rs +++ b/examples/import_task.rs @@ -7,11 +7,12 @@ use std::io::stdin; use task_hookrs::import::import; use task_hookrs::status::TaskStatus; +use task_hookrs::task::Task; fn main() { let mut tasks = import(stdin()).unwrap(); assert_eq!(tasks.len(), 1); - let t = tasks.pop().unwrap(); + let t: Task = tasks.pop().unwrap(); assert_eq!(*t.status(), TaskStatus::Pending); assert_eq!(*t.description(), "Test task".to_owned()); assert_eq!(t.priority(), None); |