diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-02-03 14:12:04 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-02-03 14:12:04 +0100 |
commit | 85589f29f9b104ea9cac1620939bf26a91f53dce (patch) | |
tree | cd90429fe7623f9f9ec787a03074dcb6cd3403fb | |
parent | 30bb654a8519d85798ecd90c285b1b46378d912d (diff) |
Add example how to create a task from Rust
-rw-r--r-- | examples/create_task.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/create_task.rs b/examples/create_task.rs new file mode 100644 index 0000000..b7eafca --- /dev/null +++ b/examples/create_task.rs @@ -0,0 +1,19 @@ +extern crate task_hookrs; +extern crate chrono; +extern crate serde_json; +extern crate uuid; + +use task_hookrs::task::Task; +use task_hookrs::status::TaskStatus; + +use chrono::NaiveDateTime; +use serde_json::to_string; +use uuid::Uuid; + +fn main() { + let uuid = Uuid::nil(); + let date = NaiveDateTime::parse_from_str("2016-12-31 12:13:14", "%Y-%m-%d %H:%M:%S").unwrap(); + let t = Task::new(TaskStatus::Pending, uuid, date.into(), "Test task".to_string(), + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,); + println!("[{}]", to_string(&t).unwrap()); +} |