summaryrefslogtreecommitdiff
path: root/src/view/mod.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/view/mod.rs
parent51bf8e89ce07864b70d7138bbc3958faf499cc67 (diff)
downloadwasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.gz
wasm-card-69ceb1f9ec68e41029759a6fcff3168adb6df373.tar.bz2
minor refactoring + comments
Diffstat (limited to 'src/view/mod.rs')
-rw-r--r--src/view/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/view/mod.rs b/src/view/mod.rs
index 7a64fed..d97c6e4 100644
--- a/src/view/mod.rs
+++ b/src/view/mod.rs
@@ -9,10 +9,15 @@ pub mod name;
pub mod address;
pub mod telephone;
+/// Trait for types that represent an input component for a vcard property.
pub trait VCardPropertyInputComponent<T: VCardPropertyInputObject<Self>>: Component {
+ /// Returns the object containing the input data.
fn get_input_object(&self) -> T;
+ /// Getter function for the title of the component
fn get_title(&self) -> String;
+ /// Getter function for an eventual error.
fn get_error(&self) -> Option<Error>;
+ /// Returns the error as `Html`
fn render_error(&self) -> Html {
html!{
<>
@@ -32,6 +37,7 @@ pub trait VCardPropertyInputComponent<T: VCardPropertyInputObject<Self>>: Compon
}
}
+/// Weak link; Useful for being able to have a list of subcomponents.
pub struct WeakComponentLink<COMP: Component>(Rc<RefCell<Option<ComponentLink<COMP>>>>);
impl<COMP: Component> Clone for WeakComponentLink<COMP> {