From 72bd933e41a742b0b4b7dcb4c023953a3ce46eae Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Wed, 8 Apr 2020 01:24:57 -0700 Subject: [PATCH] add MapRow impls; closes #228 --- sqlx-core/src/row.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sqlx-core/src/row.rs b/sqlx-core/src/row.rs index 3e10ecf8..0538fbd7 100644 --- a/sqlx-core/src/row.rs +++ b/sqlx-core/src/row.rs @@ -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 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 crate::query::TryMapRow<$DB> for F where F: for<'c> FnMut($R<'c>) -> crate::Result,