From aae19221b6450ef86c69572787b7b19d6cad0f65 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 23 Sep 2017 20:18:30 +0200 Subject: [PATCH] Impl Contact::get_contact_data() --- lib/domain/libimagcontact/src/contact.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/domain/libimagcontact/src/contact.rs b/lib/domain/libimagcontact/src/contact.rs index d2cc3059..61dea3ab 100644 --- a/lib/domain/libimagcontact/src/contact.rs +++ b/lib/domain/libimagcontact/src/contact.rs @@ -23,6 +23,7 @@ use libimagstore::store::Entry; use libimagentryref::reference::Ref; use error::Result; +use util; /// Trait to be implemented on ::libimagstore::store::Entry /// @@ -38,12 +39,19 @@ pub trait Contact : Ref { } impl Contact for Entry { + fn get_contact_data(&self) -> Result { - unimplemented!() + let component = self + .fs_file() + .map_err(From::from) + .and_then(util::read_to_string) + .and_then(util::parse)?; + + Ok(ContactData(component)) } + } -pub struct ContactData { - components: Vec, -} +pub struct ContactData(Component); +