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>
This commit is contained in:
parent
d9e4eaad3c
commit
89059bb7da
1 changed files with 5 additions and 1 deletions
|
@ -39,6 +39,7 @@ use std::path::PathBuf;
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
|
|
||||||
use vobject::vcard::Vcard;
|
use vobject::vcard::Vcard;
|
||||||
|
use vobject::vcard::VcardBuilder;
|
||||||
use vobject::write_component;
|
use vobject::write_component;
|
||||||
use toml_query::read::TomlValueReadExt;
|
use toml_query::read::TomlValueReadExt;
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
@ -208,7 +209,7 @@ pub fn create(rt: &Runtime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_toml_into_vcard(toml: Value, uuid: String) -> Option<Vcard> {
|
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
|
{ // parse name
|
||||||
debug!("Parsing 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)
|
Some(vcard)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue