mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-14 14:46:37 +00:00
Add Records::retain
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
4ec96064b6
commit
339713f989
1 changed files with 4 additions and 0 deletions
|
@ -214,6 +214,10 @@ impl Records {
|
||||||
self.data.remove(value.as_ref())
|
self.data.remove(value.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn retain(&mut self, mut f: impl FnMut(&CrateInfo) -> bool) {
|
||||||
|
self.data.retain(|data| f(&data.crate_info))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn take(&mut self, value: impl AsRef<str>) -> Option<CrateInfo> {
|
pub fn take(&mut self, value: impl AsRef<str>) -> Option<CrateInfo> {
|
||||||
self.data.take(value.as_ref()).map(CrateInfo::from)
|
self.data.take(value.as_ref()).map(CrateInfo::from)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue