summaryrefslogtreecommitdiff
path: root/src/viewmodel/name.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-09 23:18:45 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-09 23:18:45 +0100
commit036a567bae8346eb38f9237f59645dbcc4f1cd8c (patch)
tree21a86e3c5cb8964030c414718190af12f3d26125 /src/viewmodel/name.rs
parent9df3ff8d633a18e934d4e62b0e2e718620760552 (diff)
downloadwasm-card-036a567bae8346eb38f9237f59645dbcc4f1cd8c.tar.gz
wasm-card-036a567bae8346eb38f9237f59645dbcc4f1cd8c.tar.bz2
switch to cargo-make; format files with rustfmt
Diffstat (limited to 'src/viewmodel/name.rs')
-rw-r--r--src/viewmodel/name.rs31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/viewmodel/name.rs b/src/viewmodel/name.rs
index ee4736f..de0aa81 100644
--- a/src/viewmodel/name.rs
+++ b/src/viewmodel/name.rs
@@ -2,7 +2,7 @@ use super::*;
use crate::view::name::*;
/// Type that represents a vcard `name` property
-///
+///
/// # Examples
/// ```
/// # use bcard_wasm_webapp::viewmodel::name::Name;
@@ -13,7 +13,7 @@ use crate::view::name::*;
/// 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, PartialEq)]
@@ -35,10 +35,13 @@ impl VCardPropertyInputObject<NameView> for Name {
suffix: String::new(),
}
}
- fn get_input_fields(&self, link: &ComponentLink<NameView>) -> std::vec::Vec<VCardPropertyInputField> {
+ fn get_input_fields(
+ &self,
+ link: &ComponentLink<NameView>,
+ ) -> std::vec::Vec<VCardPropertyInputField> {
let typ = String::from("text");
vec![
- VCardPropertyInputField::Text{
+ VCardPropertyInputField::Text {
label: "Prefix".to_string(),
id: Some("prefix".to_string()),
placeholder: Some("Sir".to_string()),
@@ -46,7 +49,7 @@ impl VCardPropertyInputObject<NameView> for Name {
value: self.prefix.clone(),
typ: typ.clone(),
},
- VCardPropertyInputField::Text{
+ VCardPropertyInputField::Text {
label: "First Name".to_string(),
id: Some("first_name".to_string()),
placeholder: Some("Arthur".to_string()),
@@ -54,7 +57,7 @@ impl VCardPropertyInputObject<NameView> for Name {
value: self.first_name.clone(),
typ: typ.clone(),
},
- VCardPropertyInputField::Text{
+ VCardPropertyInputField::Text {
label: "Middle Name".to_string(),
id: Some("middle_name".to_string()),
placeholder: Some("Charles".to_string()),
@@ -62,7 +65,7 @@ impl VCardPropertyInputObject<NameView> for Name {
value: self.middle_name.clone(),
typ: typ.clone(),
},
- VCardPropertyInputField::Text{
+ VCardPropertyInputField::Text {
label: "Last Name".to_string(),
id: Some("last_name".to_string()),
placeholder: Some("Clarke".to_string()),
@@ -70,7 +73,7 @@ impl VCardPropertyInputObject<NameView> for Name {
value: self.last_name.clone(),
typ: typ.clone(),
},
- VCardPropertyInputField::Text{
+ VCardPropertyInputField::Text {
label: "Suffix".to_string(),
id: Some("suffix".to_string()),
placeholder: Some("CBE FRAS".to_string()),
@@ -81,11 +84,11 @@ impl VCardPropertyInputObject<NameView> for Name {
]
}
fn is_empty(&self) -> bool {
- self.prefix.is_empty() &&
- self.first_name.is_empty() &&
- self.middle_name.is_empty() &&
- self.last_name.is_empty() &&
- self.suffix.is_empty()
+ self.prefix.is_empty()
+ && self.first_name.is_empty()
+ && self.middle_name.is_empty()
+ && self.last_name.is_empty()
+ && self.suffix.is_empty()
}
}
@@ -113,4 +116,4 @@ impl Name {
full_name
}
-} \ No newline at end of file
+}