diff options
author | jelemux <jeremias.weber@protonmail.com> | 2021-02-03 07:08:49 +0100 |
---|---|---|
committer | jelemux <jeremias.weber@protonmail.com> | 2021-02-03 07:08:49 +0100 |
commit | 51bf8e89ce07864b70d7138bbc3958faf499cc67 (patch) | |
tree | 31e870adb0bcd539135059613e05a0f31e08e987 /snippets | |
parent | 94a0e361e180223adf2bc9760c8810dfa3c2681f (diff) | |
download | wasm-card-51bf8e89ce07864b70d7138bbc3958faf499cc67.tar.gz wasm-card-51bf8e89ce07864b70d7138bbc3958faf499cc67.tar.bz2 |
now it compiles
Diffstat (limited to 'snippets')
-rw-r--r-- | snippets | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/snippets b/snippets new file mode 100644 index 0000000..dc4e601 --- /dev/null +++ b/snippets @@ -0,0 +1,103 @@ + + + match self.vcard_data.get_mut() { + Some(vcard_builder) => *vcard_builder = vcard_builder.with_name( + parameters!(), + name.last_name.is_empty().then(|| name.last_name), + name.first_name.is_empty().then(|| name.first_name), + name.middle_name.is_empty().then(|| name.middle_name), + name.prefix.is_empty().then(|| name.prefix), + name.suffix.is_empty().then(|| name.suffix) + ), + None => (), + }; + + -------------------------------------------------------------- + + let mut types = String::new(); + if address.work { + types.push_str("WORK"); + } + if address.home { + if types.is_empty() { + types.push(','); + } + types.push_str("HOME") + } + + match self.vcard_data.get_mut() { + Some(vcard_builder) => *vcard_builder = vcard_builder.with_adr( + parameters!("TYPE" => types), + address.post_office_box.is_empty().then(|| address.post_office_box), + address.extension.is_empty().then(|| address.extension), + address.street.is_empty().then(|| address.street), + address.locality.is_empty().then(|| address.locality), + address.region.is_empty().then(|| address.region), + address.code.is_empty().then(|| address.code), + address.country.is_empty().then(|| address.country), + ), + None => (), + }; + + ---------------------------------------------------------------- + + let mut types = String::new(); + if telephone.work { + types.push_str("WORK"); + } + if telephone.home { + if types.is_empty() { + types.push(','); + } + types.push_str("HOME") + } + if telephone.text { + if types.is_empty() { + types.push(','); + } + types.push_str("TEXT") + } + if telephone.voice { + if types.is_empty() { + types.push(','); + } + types.push_str("VOICE") + } + if telephone.fax { + if types.is_empty() { + types.push(','); + } + types.push_str("FAX") + } + if telephone.cell { + if types.is_empty() { + types.push(','); + } + types.push_str("CELL") + } + if telephone.video { + if types.is_empty() { + types.push(','); + } + types.push_str("VIDEO") + } + if telephone.pager { + if types.is_empty() { + types.push(','); + } + types.push_str("PAGER") + } + if telephone.text_phone { + if types.is_empty() { + types.push(','); + } + types.push_str("TEXTPHONE") + } + + match self.vcard_data.get_mut() { + Some(vcard_builder) => *vcard_builder = vcard_builder.with_tel( + parameters!("TYPE" => types), + telephone.number, + ), + None => (), + };
\ No newline at end of file |