From 077471f3da318518eebae937c089a43f475cde80 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 15 Jul 2016 15:41:51 +0200 Subject: [PATCH] Impl Task::retrieve_from_string --- libimagtodo/src/task.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libimagtodo/src/task.rs b/libimagtodo/src/task.rs index 127deae9..4e46feff 100644 --- a/libimagtodo/src/task.rs +++ b/libimagtodo/src/task.rs @@ -89,7 +89,13 @@ impl<'a> Task<'a> { /// Retrieve a task from a String. The String is expected to contain the JSON-representation of /// the Task to retrieve from the store (only the UUID really matters in this case) pub fn retrieve_from_string(store: &'a Store, s: String) -> Result> { - unimplemented!() + Task::get_from_string(store, s) + .and_then(|opt| match opt { + Ok(task) => Ok(task), + Err(string) => import_task(string.as_str()) + .map_err_into(TodoErrorKind::ImportError) + .and_then(|t| t.into_task(store)), + }) } pub fn delete_by_uuid(store: &Store, uuid: Uuid) -> Result<()> {