mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
Don't make StoreState public
This commit is contained in:
@@ -123,7 +123,7 @@ fn main() {
|
|||||||
.plugin(tauri_plugin_store::Builder::default().build())
|
.plugin(tauri_plugin_store::Builder::default().build())
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
// This loads the store from disk
|
// This loads the store from disk
|
||||||
let store = app.store("app_data.json");
|
let store = app.store("app_data.json")?;
|
||||||
|
|
||||||
// Note that values must be serde_json::Value instances,
|
// Note that values must be serde_json::Value instances,
|
||||||
// otherwise, they will not be compatible with the JavaScript bindings.
|
// otherwise, they will not be compatible with the JavaScript bindings.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct ChangePayload<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StoreState {
|
struct StoreState {
|
||||||
stores: Arc<Mutex<HashMap<PathBuf, ResourceId>>>,
|
stores: Arc<Mutex<HashMap<PathBuf, ResourceId>>>,
|
||||||
serialize_fns: HashMap<String, SerializeFn>,
|
serialize_fns: HashMap<String, SerializeFn>,
|
||||||
deserialize_fns: HashMap<String, DeserializeFn>,
|
deserialize_fns: HashMap<String, DeserializeFn>,
|
||||||
@@ -327,7 +327,6 @@ pub trait StoreExt<R: Runtime> {
|
|||||||
|
|
||||||
impl<R: Runtime, T: Manager<R>> StoreExt<R> for T {
|
impl<R: Runtime, T: Manager<R>> StoreExt<R> for T {
|
||||||
fn store(&self, path: impl AsRef<Path>) -> Result<Arc<Store<R>>> {
|
fn store(&self, path: impl AsRef<Path>) -> Result<Arc<Store<R>>> {
|
||||||
let path = path.as_ref();
|
|
||||||
StoreBuilder::new(self.app_handle(), path).new_or_existing()
|
StoreBuilder::new(self.app_handle(), path).new_or_existing()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user