diesel/expression/ops/
mod.rs

1macro_rules! generic_numeric_expr_inner {
2    ($tpe: ident, ($($param: ident),*), $op: ident, $fn_name: ident) => {
3        impl<Rhs, $($param),*> ::std::ops::$op<Rhs> for $tpe<$($param),*> where
4            $tpe<$($param),*>: $crate::expression::Expression,
5            <$tpe<$($param),*> as $crate::Expression>::SqlType: $crate::sql_types::SqlType + $crate::sql_types::ops::$op,
6            <<$tpe<$($param),*> as $crate::Expression>::SqlType as $crate::sql_types::ops::$op>::Rhs: $crate::expression::TypedExpressionType,
7            Rhs: $crate::expression::AsExpression<
8                <<$tpe<$($param),*> as $crate::Expression>::SqlType as $crate::sql_types::ops::$op>::Rhs,
9            >,
10        {
11            type Output = $crate::expression::ops::$op<Self, Rhs::Expression>;
12
13            fn $fn_name(self, rhs: Rhs) -> Self::Output {
14                $crate::expression::ops::$op::new(self, rhs.as_expression())
15            }
16        }
17    }
18}
19
20macro_rules! generic_numeric_expr {
21    ($tpe: ident, $($param: ident),*) => {
22        generic_numeric_expr_inner!($tpe, ($($param),*), Add, add);
23        generic_numeric_expr_inner!($tpe, ($($param),*), Sub, sub);
24        generic_numeric_expr_inner!($tpe, ($($param),*), Div, div);
25        generic_numeric_expr_inner!($tpe, ($($param),*), Mul, mul);
26    }
27}
28
29pub(crate) mod numeric;
30
31pub(crate) use self::numeric::{Add, Div, Mul, Sub};