summaryrefslogtreecommitdiffstats
path: root/src/contact.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 16:10:26 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 17:27:40 +0100
commit6ee4190a26f32bfa953302ee363ad3bb6c384ebb (patch)
tree2c3182c29d5780a0ad9c9770b5e546312bea49b4 /src/contact.rs
parentf76c80c1d23177ab00c81240ee3a75d3bcda0e3b (diff)
downloadmacaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.tar.gz
macaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.tar.bz2
macaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.zip
refactor: reorganise code
Diffstat (limited to '')
-rw-r--r--src/contact.rs35
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
+ }
+}
+