blob: e9ab21f5a9b916d37e4bdd1ac4e580c268dc9205 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
}
}
|