mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-04 00:05:27 +00:00
add MapRow impls; closes #228
This commit is contained in:
parent
0e61642165
commit
72bd933e41
@ -337,6 +337,17 @@ macro_rules! impl_from_row_for_tuples {
|
|||||||
#[allow(unused_macros)]
|
#[allow(unused_macros)]
|
||||||
macro_rules! impl_map_row_for_row {
|
macro_rules! impl_map_row_for_row {
|
||||||
($DB:ident, $R:ident) => {
|
($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
|
impl<O: Unpin, F> crate::query::TryMapRow<$DB> for F
|
||||||
where
|
where
|
||||||
F: for<'c> FnMut($R<'c>) -> crate::Result<O>,
|
F: for<'c> FnMut($R<'c>) -> crate::Result<O>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user