Skip to content

Commit

Permalink
Implement a similar change for the SqlType impls
Browse files Browse the repository at this point in the history
This does **increase** the build time drastically. For me a build with
`cargo check --no-default-features --features "sqlite"` (so no large
number of supported columns!) takes nearly 13 minutes. This is obviously
not acceptable.
  • Loading branch information
weiznich committed May 3, 2022
1 parent 61351f7 commit efa182f
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions diesel/src/type_impls/tuples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,45 +482,14 @@ macro_rules! impl_valid_grouping_for_tuple_of_columns {
}

macro_rules! impl_sql_type {
(
@build
start_ts = [$($ST: ident,)*],
ts = [$T1: ident,],
bounds = [$($bounds: tt)*],
is_null = [$($is_null: tt)*],
)=> {
impl<$($ST,)*> SqlType for ($($ST,)*)
($T1: ident, $($T: ident,)+) => {
impl<$T1, $($T,)*> SqlType for ($T1, $($T,)*)
where
$($ST: SqlType,)*
$($bounds)*
$T1::IsNull: OneIsNullable<$($is_null)*>,
$T1: SqlType,
($($T,)*): SqlType,
$T1::IsNull: OneIsNullable<<($($T,)*) as SqlType>::IsNull>,
{
type IsNull = <$T1::IsNull as OneIsNullable<$($is_null)*>>::Out;
}

};
(
@build
start_ts = [$($ST: ident,)*],
ts = [$T1: ident, $($T: ident,)+],
bounds = [$($bounds: tt)*],
is_null = [$($is_null: tt)*],
)=> {
impl_sql_type!{
@build
start_ts = [$($ST,)*],
ts = [$($T,)*],
bounds = [$($bounds)* $T1::IsNull: OneIsNullable<$($is_null)*>,],
is_null = [<$T1::IsNull as OneIsNullable<$($is_null)*>>::Out],
}
};
($T1: ident, $($T: ident,)+) => {
impl_sql_type!{
@build
start_ts = [$T1, $($T,)*],
ts = [$($T,)*],
bounds = [],
is_null = [$T1::IsNull],
type IsNull = <$T1::IsNull as OneIsNullable<<($($T,)*) as SqlType>::IsNull>>::Out;
}
};
($T1: ident,) => {
Expand Down

0 comments on commit efa182f

Please sign in to comment.