From 8713864b0351c71d250814a554e31dfd0499b741 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 23 Jan 2026 04:09:44 +0800 Subject: Add pure analysis result type and conversion Introduce AnalyzeResultPure struct to hold owned data, separating it from the borrowed lifetime in AnalyzeResult. Provide From conversion to enable easy transformation between the two types. --- data/src/data/local/workspace_analyzer.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'data') diff --git a/data/src/data/local/workspace_analyzer.rs b/data/src/data/local/workspace_analyzer.rs index f2d83ff..9d1c64d 100644 --- a/data/src/data/local/workspace_analyzer.rs +++ b/data/src/data/local/workspace_analyzer.rs @@ -41,6 +41,36 @@ pub struct AnalyzeResult<'a> { pub modified: HashSet, } +pub struct AnalyzeResultPure { + /// Moved local files + pub moved: HashMap, + + /// Newly created local files + pub created: HashSet, + + /// Lost local files + pub lost: HashSet, + + /// Erased local files + pub erased: HashSet, + + /// Modified local files (excluding moved files) + /// For files that were both moved and modified, changes can only be detected after LocalSheet mapping is aligned with actual files + pub modified: HashSet, +} + +impl<'a> From> for AnalyzeResultPure { + fn from(result: AnalyzeResult<'a>) -> Self { + AnalyzeResultPure { + moved: result.moved, + created: result.created, + lost: result.lost, + erased: result.erased, + modified: result.modified, + } + } +} + struct AnalyzeContext<'a> { member: MemberId, sheet_name: SheetName, -- cgit