From 69ceb1f9ec68e41029759a6fcff3168adb6df373 Mon Sep 17 00:00:00 2001 From: jelemux Date: Thu, 4 Feb 2021 13:30:15 +0100 Subject: minor refactoring + comments --- src/viewmodel/name.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/viewmodel/name.rs') 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); } -- cgit v1.2.3