mirror of
				https://github.com/WarrenHood/MCModpackManager.git
				synced 2025-11-04 07:58:40 +00:00 
			
		
		
		
	Switched to using a BTreeMap instead of a HashMap to preserve toml ordering
This commit is contained in:
		
							parent
							
								
									1ead48cbc2
								
							
						
					
					
						commit
						c216873393
					
				
							
								
								
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| 
						 | 
					@ -3710,6 +3710,7 @@ version = "0.8.19"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
 | 
					checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "indexmap",
 | 
				
			||||||
 "serde",
 | 
					 "serde",
 | 
				
			||||||
 "serde_spanned",
 | 
					 "serde_spanned",
 | 
				
			||||||
 "toml_datetime",
 | 
					 "toml_datetime",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,4 +16,4 @@ serde = { version = "1.0.207", features = ["derive"] }
 | 
				
			||||||
sha2 = "0.10.8"
 | 
					sha2 = "0.10.8"
 | 
				
			||||||
tempfile = "3.12.0"
 | 
					tempfile = "3.12.0"
 | 
				
			||||||
tokio = { version = "1.39.2", features = ["full"] }
 | 
					tokio = { version = "1.39.2", features = ["full"] }
 | 
				
			||||||
toml = "0.8.19"
 | 
					toml = { version = "0.8.19", features = ["preserve_order"] }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@ use crate::mod_meta::{ModMeta, ModProvider};
 | 
				
			||||||
use anyhow::Result;
 | 
					use anyhow::Result;
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use std::{
 | 
					use std::{
 | 
				
			||||||
    collections::{HashMap, HashSet},
 | 
					    collections::{BTreeMap, HashSet},
 | 
				
			||||||
    path::{Path, PathBuf},
 | 
					    path::{Path, PathBuf},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ pub struct ModpackMeta {
 | 
				
			||||||
    pub pack_name: String,
 | 
					    pub pack_name: String,
 | 
				
			||||||
    pub mc_version: String,
 | 
					    pub mc_version: String,
 | 
				
			||||||
    pub modloader: ModLoader,
 | 
					    pub modloader: ModLoader,
 | 
				
			||||||
    pub mods: HashMap<String, ModMeta>,
 | 
					    pub mods: BTreeMap<String, ModMeta>,
 | 
				
			||||||
    pub default_providers: Vec<ModProvider>,
 | 
					    pub default_providers: Vec<ModProvider>,
 | 
				
			||||||
    pub forbidden_mods: HashSet<String>,
 | 
					    pub forbidden_mods: HashSet<String>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ impl ModpackMeta {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn iter_mods(&self) -> std::collections::hash_map::Values<String, ModMeta> {
 | 
					    pub fn iter_mods(&self) -> std::collections::btree_map::Values<String, ModMeta> {
 | 
				
			||||||
        self.mods.values().into_iter()
 | 
					        self.mods.values().into_iter()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,7 @@
 | 
				
			||||||
use anyhow::Result;
 | 
					use anyhow::Result;
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use std::{
 | 
					use std::{
 | 
				
			||||||
    collections::HashMap,
 | 
					    collections::BTreeMap,
 | 
				
			||||||
    error::Error,
 | 
					 | 
				
			||||||
    fmt::Display,
 | 
					    fmt::Display,
 | 
				
			||||||
    path::{Path, PathBuf},
 | 
					    path::{Path, PathBuf},
 | 
				
			||||||
    str::FromStr,
 | 
					    str::FromStr,
 | 
				
			||||||
| 
						 | 
					@ -80,7 +79,7 @@ impl Profile {
 | 
				
			||||||
/// User data and configs for the modpack manager
 | 
					/// User data and configs for the modpack manager
 | 
				
			||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
 | 
					#[derive(Debug, Clone, Serialize, Deserialize)]
 | 
				
			||||||
pub struct Data {
 | 
					pub struct Data {
 | 
				
			||||||
    profiles: HashMap<String, Profile>,
 | 
					    profiles: BTreeMap<String, Profile>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Default for Data {
 | 
					impl Default for Data {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,7 @@ use anyhow::Result;
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use sha2::{Digest, Sha512};
 | 
					use sha2::{Digest, Sha512};
 | 
				
			||||||
use std::{
 | 
					use std::{
 | 
				
			||||||
    collections::{HashMap, HashSet},
 | 
					    collections::{BTreeMap, HashSet},
 | 
				
			||||||
    error::Error,
 | 
					 | 
				
			||||||
    ffi::{OsStr, OsString},
 | 
					    ffi::{OsStr, OsString},
 | 
				
			||||||
    path::{Path, PathBuf},
 | 
					    path::{Path, PathBuf},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -18,7 +17,7 @@ const MODPACK_LOCK_FILENAME: &str = "modpack.lock";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Serialize, Deserialize)]
 | 
					#[derive(Serialize, Deserialize)]
 | 
				
			||||||
pub struct PinnedPackMeta {
 | 
					pub struct PinnedPackMeta {
 | 
				
			||||||
    mods: HashMap<String, PinnedMod>,
 | 
					    mods: BTreeMap<String, PinnedMod>,
 | 
				
			||||||
    #[serde(skip_serializing, skip_deserializing)]
 | 
					    #[serde(skip_serializing, skip_deserializing)]
 | 
				
			||||||
    modrinth: Modrinth,
 | 
					    modrinth: Modrinth,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue