Skip to content

Commit

Permalink
add MapRow impls; closes #228
Browse files Browse the repository at this point in the history
  • Loading branch information
mehcode committed Apr 8, 2020
1 parent 0e61642 commit 72bd933
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sqlx-core/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit 72bd933

Please sign in to comment.