diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-07-15 15:34:31 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-21 17:14:12 +0200 |
commit | 302b46be5f7ccd9a05d5d3df06372554b7548ef9 (patch) | |
tree | 908be8d49c65d43b09dc0a8599e65242f836dfb0 /libimagtodo | |
parent | 475a73ee5c1034d3c59dc4804ae35c9d431dacc9 (diff) |
Impl Task::get_from_string()
Diffstat (limited to 'libimagtodo')
-rw-r--r-- | libimagtodo/src/task.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libimagtodo/src/task.rs b/libimagtodo/src/task.rs index 36f4a75d..3459bdfc 100644 --- a/libimagtodo/src/task.rs +++ b/libimagtodo/src/task.rs @@ -59,7 +59,14 @@ impl<'a> Task<'a> { /// /// For an explanation on the return values see `Task::get_from_import()`. pub fn get_from_string(store: &'a Store, s: String) -> Result<RResult<Task<'a>, String>> { - unimplemented!() + import_task(s.as_str()) + .map_err_into(TodoErrorKind::ImportError) + .map(|t| t.uuid().clone()) + .and_then(|uuid| Task::get_from_uuid(store, uuid)) + .and_then(|o| match o { + None => Ok(Err(s)), + Some(t) => Ok(Ok(t)), + }) } /// Get a task from an UUID. |