whatsapp_rust/store/
mod.rs1pub mod commands;
2pub mod error;
3pub mod persistence_manager;
4pub mod signal;
5pub mod signal_adapter;
6pub mod signal_cache;
7pub mod traits;
8
9#[cfg(feature = "sqlite-storage")]
11pub use whatsapp_rust_sqlite_storage::{
12 ConnectionInitHook, SqliteStore, SqliteStoreConfig, Synchronous,
13};
14
15pub use crate::store::traits::*;
16use std::ops::{Deref, DerefMut};
17use std::sync::Arc;
18
19#[derive(Clone)]
20pub struct Device {
21 pub core: wacore::store::Device,
22 pub backend: Arc<dyn Backend>,
23}
24
25impl Deref for Device {
26 type Target = wacore::store::Device;
27
28 fn deref(&self) -> &Self::Target {
29 &self.core
30 }
31}
32
33impl DerefMut for Device {
34 fn deref_mut(&mut self) -> &mut Self::Target {
35 &mut self.core
36 }
37}
38
39impl Device {
40 pub fn new(backend: Arc<dyn Backend>) -> Self {
41 let core = wacore::store::Device::new();
42 Self { core, backend }
43 }
44
45 pub fn to_serializable(&self) -> wacore::store::Device {
46 self.core.clone()
47 }
48
49 pub fn load_from_serializable(&mut self, loaded: wacore::store::Device) {
50 self.core = loaded;
51 }
52}