diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-23 04:09:44 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-23 04:09:44 +0800 |
| commit | 8713864b0351c71d250814a554e31dfd0499b741 (patch) | |
| tree | 69435746d00a2a87841915b96daf5739c54af864 /data | |
| parent | 3003ef7c113ee062ff8e6553bc6cd7504c48c629 (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.
Diffstat (limited to 'data')
| -rw-r--r-- | data/src/data/local/workspace_analyzer.rs | 30 |
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, |
