mirror of
https://github.com/nushell/nushell.git
synced 2025-06-19 17:38:14 +02:00
Add Record::retain_mut
implementation
This commit is contained in:
parent
50313b89c1
commit
84ba4bfa94
@ -183,8 +183,10 @@ impl Record {
|
||||
where
|
||||
F: FnMut(&str, &mut Value) -> bool,
|
||||
{
|
||||
todo!()
|
||||
// self.inner.retain_mut(|(col, val)| keep(col, val));
|
||||
self.inner = std::mem::take(&mut self.inner)
|
||||
.into_iter()
|
||||
.filter_map(|(col, mut val)| keep(&col, &mut val).then_some((col, val)))
|
||||
.collect();
|
||||
}
|
||||
|
||||
/// Truncate record to the first `len` elements.
|
||||
|
Loading…
x
Reference in New Issue
Block a user