Maps each child of `self` using the provided closure `f`. The closure `f` takes ownership of an expression and returns a `Transformed` result, indicating whether the expression was transformed or left unchanged.
(
self,
f: F,
)
| 122 | /// The closure `f` takes ownership of an expression and returns a `Transformed` result, |
| 123 | /// indicating whether the expression was transformed or left unchanged. |
| 124 | fn map_children<F: FnMut(Self) -> Result<Transformed<Self>>>( |
| 125 | self, |
| 126 | f: F, |
| 127 | ) -> Result<Transformed<Self>> { |
| 128 | Ok(match self { |
| 129 | // TODO: remove the next line after `Expr::Wildcard` is removed |
| 130 | #[expect(deprecated)] |
| 131 | Expr::Column(_) |
| 132 | | Expr::Wildcard { .. } |
| 133 | | Expr::Placeholder(Placeholder { .. }) |
| 134 | | Expr::OuterReferenceColumn(_, _) |
| 135 | | Expr::Exists { .. } |
| 136 | | Expr::ScalarSubquery(_) |
| 137 | | Expr::ScalarVariable(_, _) |
| 138 | | Expr::Literal(_, _) |
| 139 | | Expr::LambdaVariable(_) => Transformed::no(self), |
| 140 | Expr::SetComparison(SetComparison { |
| 141 | expr, |
| 142 | subquery, |
| 143 | op, |
| 144 | quantifier, |
| 145 | }) => expr.map_elements(f)?.update_data(|expr| { |
| 146 | Expr::SetComparison(SetComparison { |
| 147 | expr, |
| 148 | subquery, |
| 149 | op, |
| 150 | quantifier, |
| 151 | }) |
| 152 | }), |
| 153 | Expr::Unnest(Unnest { expr, .. }) => expr |
| 154 | .map_elements(f)? |
| 155 | .update_data(|expr| Expr::Unnest(Unnest { expr })), |
| 156 | Expr::Alias(Alias { |
| 157 | expr, |
| 158 | relation, |
| 159 | name, |
| 160 | metadata, |
| 161 | }) => expr.map_elements(f)?.update_data(|expr| { |
| 162 | Expr::Alias(Alias { |
| 163 | expr, |
| 164 | relation, |
| 165 | name, |
| 166 | metadata, |
| 167 | }) |
| 168 | }), |
| 169 | Expr::InSubquery(InSubquery { |
| 170 | expr, |
| 171 | subquery, |
| 172 | negated, |
| 173 | }) => expr.map_elements(f)?.update_data(|be| { |
| 174 | Expr::InSubquery(InSubquery::new(be, subquery, negated)) |
| 175 | }), |
| 176 | Expr::BinaryExpr(BinaryExpr { left, op, right }) => (left, right) |
| 177 | .map_elements(f)? |
| 178 | .update_data(|(new_left, new_right)| { |
| 179 | Expr::BinaryExpr(BinaryExpr::new(new_left, op, new_right)) |
| 180 | }), |
| 181 | Expr::Like(Like { |
no test coverage detected