From 20229ea2b94237d7a56dfee6f15c1083ccaf2e21 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Thu, 2 Jul 2020 23:03:14 -0700 Subject: [PATCH] fix: actually use TryMapRow and MapRow in Query --- sqlx-core/src/query.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sqlx-core/src/query.rs b/sqlx-core/src/query.rs index 61dec8cd28..ae151f4623 100644 --- a/sqlx-core/src/query.rs +++ b/sqlx-core/src/query.rs @@ -79,11 +79,12 @@ where /// The [`query_as`](crate::query_as::query_as) method will construct a mapped query using /// a [`FromRow`](crate::row::FromRow) implementation. #[inline] - pub fn map(self, f: F) -> Map<'q, DB, impl Fn(DB::Row) -> Result, A> + pub fn map(self, f: F) -> Map<'q, DB, impl TryMapRow, A> where - F: Fn(DB::Row) -> O, + F: MapRow, + O: Unpin, { - self.try_map(move |row| Ok(f(row))) + self.try_map(MapRowAdapter(f)) } /// Map each row in the result to another type. @@ -91,9 +92,9 @@ where /// The [`query_as`](crate::query_as::query_as) method will construct a mapped query using /// a [`FromRow`](crate::row::FromRow) implementation. #[inline] - pub fn try_map(self, f: F) -> Map<'q, DB, F, A> + pub fn try_map(self, f: F) -> Map<'q, DB, F, A> where - F: Fn(DB::Row) -> Result, + F: TryMapRow, { Map { inner: self,