From b05c8c6f6dc57bf1a121cb9684420ef08fceff61 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 2 Oct 2017 20:44:08 +0200 Subject: [PATCH] Replace search_contact() with all_contacts() We can then use filters to filter out the non relevant ones. --- lib/domain/libimagcontact/src/store.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/domain/libimagcontact/src/store.rs b/lib/domain/libimagcontact/src/store.rs index 4d166bf6..770c08ff 100644 --- a/lib/domain/libimagcontact/src/store.rs +++ b/lib/domain/libimagcontact/src/store.rs @@ -25,6 +25,7 @@ use toml_query::insert::TomlValueInsertExt; use libimagstore::store::Store; use libimagstore::store::FileLockEntry; +use libimagstore::storeid::StoreIdIterator; use libimagentryref::refstore::RefStore; use libimagentryref::flags::RefFlags; @@ -45,9 +46,16 @@ pub trait ContactStore<'a> : RefStore { // getting - fn search_contact(&'a self /* later more params */) -> Result>; + fn all_contacts(&'a self) -> Result; } +/// The extension for the Store to work with contacts +/// +/// The contact functionality is implemented by using the `libimagentryref` library, so basically +/// we only reference vcard files from outside the store. +/// +/// Because of this, we do not have an own store collection `/contacts` or something like that, but +/// must stress the `libimagentryref` API for everything. impl<'a> ContactStore<'a> for Store { fn create_from_path(&'a self, p: &PathBuf) -> Result> { @@ -70,8 +78,9 @@ impl<'a> ContactStore<'a> for Store { }) } - fn search_contact(&'a self /* later more params */) -> Result> { - unimplemented!() + fn all_contacts(&'a self) -> Result { + self.all_references().map_err(From::from) } } +