refactor(profile): extract profile models and index rules

Move profile models and index rules into the crate, preserving serialization and returning a typed missing-profile error.
This commit is contained in:
Tunglies
2026-11-30 18:44:12 +08:00
parent b1281d78fe
commit e31c01894a
19 changed files with 1017 additions and 856 deletions
+2 -3
View File
@@ -6,7 +6,7 @@ use crate::core::handle::Handle;
use crate::core::notify::NoticeStatus;
use crate::utils::dirs;
use crate::{
config::{Config, IProfiles, IVerge, PrfItem},
config::{Config, IProfiles, IVerge, PrfItem, profiles::current_mapping},
constants,
utils::tmpl,
};
@@ -139,8 +139,7 @@ async fn collect_profile_items(profiles: &IProfiles) -> Result<RenderProfile> {
None => return Ok(default_profile()),
};
let current = profiles
.current_mapping()
let current = current_mapping(profiles)
.await
.with_context(|| format!("failed to read current profile \"{current_profile_uid}\""))?;