summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-01-23 04:09:44 +0800
committer魏曹先生 <1992414357@qq.com>2026-01-23 04:09:44 +0800
commit8713864b0351c71d250814a554e31dfd0499b741 (patch)
tree69435746d00a2a87841915b96daf5739c54af864
parent3003ef7c113ee062ff8e6553bc6cd7504c48c629 (diff)
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.
-rw-r--r--data/src/data/local/workspace_analyzer.rs30
1 files changed, 30 insertions, 0 deletions
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<ModifiedRelativePathBuf>,
}
+pub struct AnalyzeResultPure {
+ /// Moved local files
+ pub moved: HashMap<VirtualFileId, (FromRelativePathBuf, ToRelativePathBuf)>,
+
+ /// Newly created local files
+ pub created: HashSet<CreatedRelativePathBuf>,
+
+ /// Lost local files
+ pub lost: HashSet<LostRelativePathBuf>,
+
+ /// Erased local files
+ pub erased: HashSet<LostRelativePathBuf>,
+
+ /// 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<ModifiedRelativePathBuf>,
+}
+
+impl<'a> From<AnalyzeResult<'a>> 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,