Iterate parts in a conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]` See [`split_conjunction_owned`] for more details and an example.
(expr: Expr)
| 1066 | /// |
| 1067 | /// See [`split_conjunction_owned`] for more details and an example. |
| 1068 | pub fn iter_conjunction_owned(expr: Expr) -> impl Iterator<Item = Expr> { |
| 1069 | let mut stack = vec![expr]; |
| 1070 | std::iter::from_fn(move || { |
| 1071 | while let Some(expr) = stack.pop() { |
| 1072 | match expr { |
| 1073 | Expr::BinaryExpr(BinaryExpr { |
| 1074 | right, |
| 1075 | op: Operator::And, |
| 1076 | left, |
| 1077 | }) => { |
| 1078 | stack.push(*right); |
| 1079 | stack.push(*left); |
| 1080 | } |
| 1081 | Expr::Alias(Alias { expr, .. }) => stack.push(*expr), |
| 1082 | other => return Some(other), |
| 1083 | } |
| 1084 | } |
| 1085 | None |
| 1086 | }) |
| 1087 | } |
| 1088 | |
| 1089 | /// Splits an owned conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]` |
| 1090 | /// |