26 |
26 |
27 /// Get the logged data as a [`Vec`] array. |
27 /// Get the logged data as a [`Vec`] array. |
28 pub fn data(&self) -> &Vec<V> { |
28 pub fn data(&self) -> &Vec<V> { |
29 &self.data |
29 &self.data |
30 } |
30 } |
|
31 |
|
32 /// Map the log with `g`. |
|
33 pub fn map<W>(self, g : impl FnMut(V) -> W) -> Logger<W> { |
|
34 Logger { data : self.data.into_iter().map(g).collect() } |
|
35 } |
31 } |
36 } |
32 |
37 |
33 impl<'a, V : Serialize + 'a> TableDump<'a> for Logger<V> { |
38 impl<'a, V : Serialize + 'a> TableDump<'a> for Logger<V> { |
34 type Iter = std::slice::Iter<'a, V>; |
39 type Iter = std::slice::Iter<'a, V>; |
35 |
40 |