Skip to content

Commit c6492e1

Browse files
committed
ui: Use BTreeMap instead of HashMap to return sorted output.
1 parent 3e45ba1 commit c6492e1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

interface/src/storage.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::collections::HashMap;
1+
use std::collections::BTreeMap;
22
use std::fs;
33
use std::path::Path;
44

@@ -34,8 +34,8 @@ pub fn update_vendor(path: &Path, dir: &str, v: &VendorConfiguration) -> Result<
3434
Ok(())
3535
}
3636

37-
pub fn get_vendors(path: &Path) -> Result<HashMap<String, VendorConfiguration>> {
38-
let mut out = HashMap::new();
37+
pub fn get_vendors(path: &Path) -> Result<BTreeMap<String, VendorConfiguration>> {
38+
let mut out = BTreeMap::new();
3939
let vendors = fs::read_dir(path.join("vendors"))?;
4040
for vendor in vendors {
4141
let vendor = vendor?.path();
@@ -106,8 +106,8 @@ pub fn update_codec(
106106
pub fn get_codecs(
107107
path: &Path,
108108
vendor_dir: &str,
109-
) -> Result<HashMap<String, (String, String, String)>> {
110-
let mut out = HashMap::new();
109+
) -> Result<BTreeMap<String, (String, String, String)>> {
110+
let mut out = BTreeMap::new();
111111
let codecs_path = path.join("vendors").join(vendor_dir).join("codecs");
112112
let codecs = fs::read_dir(&codecs_path)?;
113113

@@ -182,8 +182,8 @@ pub fn update_profile(
182182
pub fn get_profiles(
183183
path: &Path,
184184
vendor_dir: &str,
185-
) -> Result<HashMap<String, ProfileConfiguration>> {
186-
let mut out = HashMap::new();
185+
) -> Result<BTreeMap<String, ProfileConfiguration>> {
186+
let mut out = BTreeMap::new();
187187
let profiles = fs::read_dir(path.join("vendors").join(vendor_dir).join("profiles"))?;
188188
for profile in profiles {
189189
let profile = profile?.path();
@@ -246,8 +246,8 @@ pub fn update_device(
246246
create_device(path, vendor_dir, name, device)
247247
}
248248

249-
pub fn get_devices(path: &Path, vendor_dir: &str) -> Result<HashMap<String, DeviceConfiguration>> {
250-
let mut out = HashMap::new();
249+
pub fn get_devices(path: &Path, vendor_dir: &str) -> Result<BTreeMap<String, DeviceConfiguration>> {
250+
let mut out = BTreeMap::new();
251251
let devices = fs::read_dir(path.join("vendors").join(vendor_dir).join("devices"))?;
252252
for device in devices {
253253
let device = device?.path();

0 commit comments

Comments
 (0)