src/logger.rs

changeset 90
b3c35d16affe
parent 50
4bc24abe77c5
equal deleted inserted replaced
25:d14c877e14b7 90:b3c35d16affe
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

mercurial