use yew::prelude::*; use std::cell::RefCell; use std::ops::Deref; use std::rc::Rc; use crate::viewmodel::*; pub mod main; pub mod name; pub mod address; pub mod telephone; pub trait VCardPropertyInputComponent: Component where P: vcard::properties::Property, T: VCardPropertyInputObject { fn get_input_object(&self) -> T; fn get_title(&self) -> String; fn get_error(&self) -> Option; fn render_error(&self) -> Html { html!{ <> { if self.get_error().is_some() { html!{
{ self.get_error().unwrap().msg }
} } else { html!{} } } } } } pub struct WeakComponentLink(Rc>>>); impl Clone for WeakComponentLink { fn clone(&self) -> Self { Self(Rc::clone(&self.0)) } } impl Default for WeakComponentLink { fn default() -> Self { Self(Rc::default()) } } impl Deref for WeakComponentLink { type Target = Rc>>>; fn deref(&self) -> &Self::Target { &self.0 } } impl PartialEq for WeakComponentLink { fn eq(&self, other: &Self) -> bool { Rc::ptr_eq(&self.0, &other.0) } }