summaryrefslogtreecommitdiffstats
path: root/bin/domain
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-09-27 14:42:58 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-09-27 15:05:45 +0200
commit89059bb7da412d6902eceb69047d1e155a4335ba (patch)
treeab35755908f0db92d989a14bf67a575177677706 /bin/domain
parentd9e4eaad3cda1ed2774bea874ad16d0d12534b1c (diff)
Fix: Use VcardBuilder instead of Vcard itself
The current implementation does not panic on VcardBuilder::build(), so we unwrap() that directly. Should be fixed in future versions of either rust-vobject or here, so that we error appropriately. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain')
-rw-r--r--bin/domain/imag-contact/src/create.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/domain/imag-contact/src/create.rs b/bin/domain/imag-contact/src/create.rs
index d5ae4131..18de82c9 100644
--- a/bin/domain/imag-contact/src/create.rs
+++ b/bin/domain/imag-contact/src/create.rs
@@ -39,6 +39,7 @@ use std::path::PathBuf;
use std::fs::OpenOptions;
use vobject::vcard::Vcard;
+use vobject::vcard::VcardBuilder;
use vobject::write_component;
use toml_query::read::TomlValueReadExt;
use toml::Value;
@@ -208,7 +209,7 @@ pub fn create(rt: &Runtime) {
}
fn parse_toml_into_vcard(toml: Value, uuid: String) -> Option<Vcard> {
- let mut vcard = Vcard::default().with_uid(uuid);
+ let mut vcard = VcardBuilder::new().with_uid(uuid);
{ // parse name
debug!("Parsing name");
@@ -448,6 +449,9 @@ fn parse_toml_into_vcard(toml: Value, uuid: String) -> Option<Vcard> {
}
+ let vcard = vcard
+ .build()
+ .unwrap(); // TODO: This unwrap does not fail with rust-vobject, why is there a Result<> returned?
Some(vcard)
}