various fixes like indentation and function names.
also moved the Result type definition to an extra file/module.
This commit is contained in:
parent
48de71d926
commit
3a9128ec7b
5 changed files with 21 additions and 20 deletions
|
@ -1,15 +1,10 @@
|
|||
|
||||
use libimagstore::storeid::{StoreIdIterator, StoreId};
|
||||
use libimagstore::store::Store;
|
||||
use error::{TodoError, TodoErrorKind};
|
||||
use task::Task;
|
||||
use result::Result;
|
||||
|
||||
use std::result::Result as RResult;
|
||||
|
||||
pub type Result<T> = RResult<T, TodoError>;
|
||||
|
||||
|
||||
pub fn all_todos(store: &Store) -> Result<TaskIterator> {
|
||||
pub fn get_todo_iterator(store: &Store) -> Result<TaskIterator> {
|
||||
|
||||
store.retrieve_for_module("uuid")
|
||||
.map(|iter| TaskIterator::new(store, iter))
|
||||
|
|
5
libimagtodo/src/result.rs
Normal file
5
libimagtodo/src/result.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use error::{TodoError, TodoErrorKind};
|
||||
|
||||
use std::result::Result as RResult;
|
||||
|
||||
pub type Result<T> = RResult<T, TodoError>;
|
|
@ -9,6 +9,7 @@ use libimagstore::storeid::IntoStoreId;
|
|||
use module_path::ModuleEntryPath;
|
||||
|
||||
use error::{TodoError, TodoErrorKind};
|
||||
use result::Result;
|
||||
|
||||
/// Task struct containing a `FileLockEntry`
|
||||
#[derive(Debug)]
|
||||
|
@ -43,10 +44,10 @@ pub trait IntoTask<'a> {
|
|||
/// println!("Task with uuid: {}", task.flentry.get_header().get("todo.uuid"));
|
||||
/// }
|
||||
/// ```
|
||||
fn into_filelockentry(self, store : &'a Store) -> Result<Task<'a>, TodoError>;
|
||||
fn into_filelockentry(self, store : &'a Store) -> Result<Task<'a>>;
|
||||
}
|
||||
impl<'a> IntoTask<'a> for TTask {
|
||||
fn into_filelockentry(self, store : &'a Store) -> Result<Task<'a>, TodoError> {
|
||||
fn into_filelockentry(self, store : &'a Store) -> Result<Task<'a>> {
|
||||
let uuid = self.uuid();
|
||||
let store_id = ModuleEntryPath::new(format!("taskwarrior/{}", uuid)).into_storeid();
|
||||
match store.retrieve(store_id) {
|
||||
|
|
Loading…
Reference in a new issue