-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
@@ -340,38 +340,47 @@ impl ResourceIndex { | |||
|
|||
pub fn update_one( | |||
&mut self, | |||
path_buf: CanonicalPathBuf, | |||
path: &dyn AsRef<Path>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update_one
to generic Path
fix #45 by changing the update_one parameter to
Asref<Path>