Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#45: Change the parameter's type of update_one to generic Path #57

Merged
merged 6 commits into from
Nov 16, 2023
Merged

Conversation

Rizary
Copy link
Collaborator

@Rizary Rizary commented Nov 4, 2023

fix #45 by changing the update_one parameter to Asref<Path>

@Rizary Rizary requested a review from kirillt November 4, 2023 02:17
src/index.rs Outdated Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
@@ -340,38 +340,47 @@ impl ResourceIndex {

pub fn update_one(
&mut self,
path_buf: CanonicalPathBuf,
path: &dyn AsRef<Path>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kirillt kirillt requested a review from gwendalF November 4, 2023 12:59
Comment on lines +413 to +428
let old_path = self
.path2id
.drain()
.into_iter()
.filter_map(|(k, v)| {
if v.id == old_id {
Some(k)
} else {
None
}
})
.collect_vec();
for p in old_path {
self.path2id.remove(&p);
}
self.id2path.remove(&old_id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should handle collisions differently to remove necessity iterate through path2id. But this should be implemented as separate issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirillt kirillt changed the title change update_one parameter to path and implement its test #45: Change the parameter's type of update_one to generic Path Nov 16, 2023
@kirillt kirillt merged commit 9b36e5e into main Nov 16, 2023
1 check passed
@kirillt kirillt deleted the fix/45 branch February 7, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function update_one cannot accept CanonicalPathBuf for deleted files
2 participants