Impl Task::retrieve_from_string

This commit is contained in:
Matthias Beyer 2016-07-15 15:41:51 +02:00
parent 58162d8d90
commit 077471f3da

View file

@ -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<Task<'a>> {
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<()> {