summaryrefslogtreecommitdiff
path: root/src/viewmodel/name.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/name.rs
parent51bf8e89ce07864b70d7138bbc3958faf499cc67 (diff)
downloadwasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.gz
wasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.bz2
minor refactoring + comments
Diffstat (limited to 'src/viewmodel/name.rs')
-rw-r--r--src/viewmodel/name.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/viewmodel/name.rs b/src/viewmodel/name.rs
index a88e07f..b6ded60 100644
--- a/src/viewmodel/name.rs
+++ b/src/viewmodel/name.rs
@@ -1,6 +1,21 @@
use super::*;
use crate::view::name::*;
+/// Type that represents a vcard `name` property
+///
+/// # Examples
+/// ```
+/// # use bcard_wasm_webapp::viewmodel::name::Name;
+/// # use crate::bcard_wasm_webapp::viewmodel::VCardPropertyInputObject;
+/// let mut name = Name::new();
+/// name.prefix = String::from("Sir");
+/// name.first_name = String::from("Arthur");
+/// name.middle_name = String::from("Charles");
+/// name.last_name = String::from("Clarke");
+/// name.suffix = String::from("CBE FRAS");
+///
+/// assert_eq!(name.generate_fn(), String::from("Sir Arthur Charles Clarke, CBE FRAS"));
+/// ```
#[derive(Clone, Debug)]
pub struct Name {
pub prefix: String,
@@ -86,7 +101,7 @@ impl Name {
full_name.push_str(&self.last_name);
}
if !self.suffix.is_empty() {
- full_name.push_str(" ");
+ full_name.push_str(", ");
full_name.push_str(&self.suffix);
}