mirror of
https://github.com/dnlbauer/xdrfile.git
synced 2026-09-10 22:25:30 +00:00
Deref rather than clone in Frame::filter_coords()
This commit is contained in:
@@ -40,14 +40,13 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Filters the frame by removing all atoms not matching the given indeces.
|
/// Filters the frame by removing all atoms not matching the given indeces.
|
||||||
pub fn filter_coords(self: &mut Frame, indeces: &[usize]) {
|
pub fn filter_coords(self: &mut Frame, indices: &[usize]) {
|
||||||
self.coords = self
|
self.coords = self
|
||||||
.coords
|
.coords
|
||||||
.iter()
|
.iter()
|
||||||
.map(|elem| elem.clone())
|
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|&(i, _)| indeces.contains(&i))
|
.filter(|(i, _)| indices.contains(i))
|
||||||
.map(|(_, elem)| elem)
|
.map(|(_, elem)| *elem)
|
||||||
.collect();
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user