add MapRow impls; closes #228

This commit is contained in:
Ryan Leckey 2020-04-08 01:24:57 -07:00
parent 0e61642165
commit 72bd933e41

View File

@ -337,6 +337,17 @@ macro_rules! impl_from_row_for_tuples {
#[allow(unused_macros)]
macro_rules! impl_map_row_for_row {
($DB:ident, $R:ident) => {
impl<O: Unpin, F> crate::query::MapRow<$DB> for F
where
F: for<'c> FnMut($R<'c>) -> O,
{
type Output = O;
fn map_row(&mut self, row: $R) -> O {
(self)(row)
}
}
impl<O: Unpin, F> crate::query::TryMapRow<$DB> for F
where
F: for<'c> FnMut($R<'c>) -> crate::Result<O>,