Add Record::retain_mut implementation

This commit is contained in:
Ian Manske 2024-04-22 18:06:08 -04:00
parent 50313b89c1
commit 84ba4bfa94

View File

@ -183,8 +183,10 @@ impl Record {
where where
F: FnMut(&str, &mut Value) -> bool, F: FnMut(&str, &mut Value) -> bool,
{ {
todo!() self.inner = std::mem::take(&mut self.inner)
// self.inner.retain_mut(|(col, val)| keep(col, val)); .into_iter()
.filter_map(|(col, mut val)| keep(&col, &mut val).then_some((col, val)))
.collect();
} }
/// Truncate record to the first `len` elements. /// Truncate record to the first `len` elements.