summaryrefslogtreecommitdiff
path: root/src/viewmodel/vcard.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-04 13:30:15 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-04 13:30:15 +0100
commit69ceb1f9ec68e41029759a6fcff3168adb6df373 (patch)
tree194f21d845da5617e1c6d7fadaab380d10e472f7 /src/viewmodel/vcard.rs
parent51bf8e89ce07864b70d7138bbc3958faf499cc67 (diff)
downloadwasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.gz
wasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.bz2
minor refactoring + comments
Diffstat (limited to 'src/viewmodel/vcard.rs')
-rw-r--r--src/viewmodel/vcard.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/viewmodel/vcard.rs b/src/viewmodel/vcard.rs
index 2d415b7..0225590 100644
--- a/src/viewmodel/vcard.rs
+++ b/src/viewmodel/vcard.rs
@@ -3,6 +3,7 @@ use crate::viewmodel::telephone::Telephone;
use crate::viewmodel::address::Address;
use crate::viewmodel::name::Name;
+/// Type that represents the data structure of a vcard.
#[derive(Clone, Debug)]
pub struct VCardData {
pub names: Vec<Irc<Name>>,
@@ -11,7 +12,7 @@ pub struct VCardData {
}
macro_rules! make_vec_adder_fn {
- ( $fnname:ident $property:ident $($arg_name:ident : $arg_type:ty),* ) => {
+ ( fn $fnname:ident $property:ident => $($arg_name:ident : $arg_type:ty),* ) => {
pub fn $fnname(&mut self, $( $arg_name : $arg_type ),*) {
$(self.$property.push($arg_name);)*
}
@@ -26,7 +27,7 @@ impl VCardData {
telephones: Vec::new(),
}
}
- make_vec_adder_fn!( add_name names name: Irc<Name> );
- make_vec_adder_fn!( add_address addresses address: Irc<Address> );
- make_vec_adder_fn!( add_telephone telephones telephone: Irc<Telephone> );
+ make_vec_adder_fn!( fn add_name names => name: Irc<Name> );
+ make_vec_adder_fn!( fn add_address addresses => address: Irc<Address> );
+ make_vec_adder_fn!( fn add_telephone telephones => telephone: Irc<Telephone> );
} \ No newline at end of file