From e729a9c83fd16fbf37254d436a7c5e992f186d87 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 31 Jul 2023 12:52:44 -0300 Subject: [PATCH] use btreemap for manifests --- core/tauri-build/src/plugin.rs | 4 +-- core/tauri-utils/src/plugin.rs | 10 +++--- examples/api/src-tauri/tauri.namespace.lock | 40 ++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/core/tauri-build/src/plugin.rs b/core/tauri-build/src/plugin.rs index 72e5b78d3..cd2b47c74 100644 --- a/core/tauri-build/src/plugin.rs +++ b/core/tauri-build/src/plugin.rs @@ -6,7 +6,7 @@ use tauri_utils::plugin::Capability; pub use tauri_utils::plugin::{Manifest, ManifestMap, ScopeType}; use std::{ - collections::HashMap, + collections::BTreeMap, env::{var_os, vars_os}, fs::{read_to_string, write}, path::PathBuf, @@ -49,7 +49,7 @@ pub fn set_manifest(mut manifest: Manifest) { } pub(crate) fn manifests() -> ManifestMap { - let mut manifests = HashMap::new(); + let mut manifests = BTreeMap::new(); for (key, value) in vars_os() { let key = key.to_string_lossy(); diff --git a/core/tauri-utils/src/plugin.rs b/core/tauri-utils/src/plugin.rs index 8b4cde91b..ad5b32c0a 100644 --- a/core/tauri-utils/src/plugin.rs +++ b/core/tauri-utils/src/plugin.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use std::{ - collections::HashMap, + collections::BTreeMap, ops::{Deref, DerefMut}, }; @@ -155,10 +155,10 @@ impl Manifest { /// A collection mapping a plugin name to its manifest. #[derive(Debug, Default, Deserialize, Serialize)] -pub struct ManifestMap(HashMap); +pub struct ManifestMap(BTreeMap); impl Deref for ManifestMap { - type Target = HashMap; + type Target = BTreeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -171,8 +171,8 @@ impl DerefMut for ManifestMap { } } -impl From> for ManifestMap { - fn from(value: HashMap) -> Self { +impl From> for ManifestMap { + fn from(value: BTreeMap) -> Self { Self(value) } } diff --git a/examples/api/src-tauri/tauri.namespace.lock b/examples/api/src-tauri/tauri.namespace.lock index 41bce69f9..92cff79f5 100644 --- a/examples/api/src-tauri/tauri.namespace.lock +++ b/examples/api/src-tauri/tauri.namespace.lock @@ -16,6 +16,26 @@ } ], "plugins": { + "__app__": { + "default_capability": null, + "capabilities": [ + { + "id": "allow-all-api-commands", + "component": null, + "description": "Allows all application defined commands", + "features": [ + "log_operation", + "perform_request" + ], + "scope": { + "allowed": [], + "blocked": [] + } + } + ], + "features": [], + "scope_type": [] + }, "event": { "plugin": "event", "default_capability": null, @@ -51,26 +71,6 @@ ], "scope_type": [] }, - "__app__": { - "default_capability": null, - "capabilities": [ - { - "id": "allow-all-api-commands", - "component": null, - "description": "Allows all application defined commands", - "features": [ - "log_operation", - "perform_request" - ], - "scope": { - "allowed": [], - "blocked": [] - } - } - ], - "features": [], - "scope_type": [] - }, "path": { "plugin": "path", "default_capability": null,