Bladeren bron

use btreemap for manifests

Lucas Nogueira 2 jaren geleden
bovenliggende
commit
e729a9c83f
3 gewijzigde bestanden met toevoegingen van 27 en 27 verwijderingen
  1. 2 2
      core/tauri-build/src/plugin.rs
  2. 5 5
      core/tauri-utils/src/plugin.rs
  3. 20 20
      examples/api/src-tauri/tauri.namespace.lock

+ 2 - 2
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();

+ 5 - 5
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<String, Manifest>);
+pub struct ManifestMap(BTreeMap<String, Manifest>);
 
 impl Deref for ManifestMap {
-  type Target = HashMap<String, Manifest>;
+  type Target = BTreeMap<String, Manifest>;
 
   fn deref(&self) -> &Self::Target {
     &self.0
@@ -171,8 +171,8 @@ impl DerefMut for ManifestMap {
   }
 }
 
-impl From<HashMap<String, Manifest>> for ManifestMap {
-  fn from(value: HashMap<String, Manifest>) -> Self {
+impl From<BTreeMap<String, Manifest>> for ManifestMap {
+  fn from(value: BTreeMap<String, Manifest>) -> Self {
     Self(value)
   }
 }

+ 20 - 20
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,