diff options
Diffstat (limited to 'src/contact.rs')
-rw-r--r-- | src/contact.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/contact.rs b/src/contact.rs new file mode 100644 index 0000000..e9ab21f --- /dev/null +++ b/src/contact.rs @@ -0,0 +1,35 @@ +use std::ops::{Deref, DerefMut}; + +use filamento::{roster::Contact, user::User}; +use reactive_stores::Store; + +use crate::user::MacawUser; + +#[derive(Clone)] +pub struct MacawContact { + pub contact: Store<Contact>, + pub user: MacawUser, +} + +impl MacawContact { + pub fn got_contact_and_user(contact: Contact, user: User) -> Self { + let contact = Store::new(contact); + let user = MacawUser::got_user(user); + Self { contact, user } + } +} + +impl Deref for MacawContact { + type Target = Store<Contact>; + + fn deref(&self) -> &Self::Target { + &self.contact + } +} + +impl DerefMut for MacawContact { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.contact + } +} + |