mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 12:14:43 +00:00
fix: trait impl bugs (2)
This commit is contained in:
parent
017b13f07b
commit
40b53a3e81
4 changed files with 61 additions and 25 deletions
|
@ -218,6 +218,11 @@ impl<K, V> Dict<K, V> {
|
|||
self.dict.retain(f);
|
||||
}
|
||||
|
||||
pub fn retained(mut self, f: impl FnMut(&K, &mut V) -> bool) -> Self {
|
||||
self.retain(f);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn get_by(&self, k: &K, cmp: impl Fn(&K, &K) -> bool) -> Option<&V> {
|
||||
for (k_, v) in self.dict.iter() {
|
||||
if cmp(k, k_) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue