Debian Codegraph @

src/macros/internal.rs

raw
1 /// This will implement `SelectableExpression` and `AppearsOnTable` for "simple"
2 /// composite nodes where the where clause is roughly `AllTyParams:
3 /// SelectableExpression<QS>, Self: Expression`.
4 ///
5 /// This macro is exported because we want to be able to call it from other
6 /// macros that are exported, but it is not part of our public API.
7 #[macro_export]
8 #[doc(hidden)]
9 macro_rules! impl_selectable_expression {
10 ($struct_name:ident) => {
11 $crate::impl_selectable_expression!(ty_params = (), struct_ty = $struct_name,);
12 };
13
14 ($struct_name:ident<$($ty_params:ident),+>) => {
15 $crate::impl_selectable_expression!(
16 ty_params = ($($ty_params),+),
17 struct_ty = $struct_name<$($ty_params),+>,
18 );
19 };
20
21 (ty_params = ($($ty_params:ident),*), struct_ty = $struct_ty:ty,) => {
22 impl<$($ty_params,)* QS> $crate::expression::SelectableExpression<QS>
23 for $struct_ty where
24 $struct_ty: $crate::expression::AppearsOnTable<QS>,
25 $($ty_params: $crate::expression::SelectableExpression<QS>,)*
26 {
27 }
28
29 impl<$($ty_params,)* QS> $crate::expression::AppearsOnTable<QS>
30 for $struct_ty where
31 $struct_ty: $crate::expression::Expression,
32 $($ty_params: $crate::expression::AppearsOnTable<QS>,)*
33 {
34 }
35 };
36 }