diff --git a/src/row.rs b/src/row.rs index b6f3491..8983b3b 100644 --- a/src/row.rs +++ b/src/row.rs @@ -41,6 +41,25 @@ impl<'stmt> Rows<'stmt> { { Map { rows: self, f } } + + /// Map over this `Rows`, converting it to a [`MappedRows`], which + /// implements `Iterator`. + pub fn mapped(self, f: F) -> MappedRows<'stmt, F> + where + F: FnMut(&Row<'_>) -> Result, + { + MappedRows { rows: self, map: f } + } + + /// Map over this `Rows` with a fallible function, converting it to a + /// [`AndThenRows`], which implements `Iterator` (instead of + /// `FallibleStreamingIterator`). + pub fn and_then(self, f: F) -> AndThenRows<'stmt, F> + where + F: FnMut(&Row<'_>) -> result::Result, + { + AndThenRows { rows: self, map: f } + } } impl<'stmt> Rows<'stmt> {