use crate::vue::{Vue, VueMarker};
use tauri::{Manager, Runtime};
use tauri_store::{ManagerExt as _, Result, Store};
pub trait ManagerExt<R: Runtime>: Manager<R> {
fn vue(&self) -> Vue<'_, R> {
Vue(
self
.app_handle()
.store_collection_with_marker::<VueMarker>(),
)
}
fn with_store<F, T>(&self, id: impl AsRef<str>, f: F) -> Result<T>
where
F: FnOnce(&mut Store<R, VueMarker>) -> T,
{
self
.app_handle()
.store_collection_with_marker::<VueMarker>()
.with_store(id, f)
}
}
impl<R: Runtime, T: Manager<R>> ManagerExt<R> for T {}