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)
| 1042 | /// |
| 1043 | /// See [`split_conjunction_owned`] for more details and an example. |
| 1044 | pub fn iter_conjunction(expr: &Expr) -> impl Iterator<Item = &Expr> { |
| 1045 | let mut stack = vec![expr]; |
| 1046 | std::iter::from_fn(move || { |
| 1047 | while let Some(expr) = stack.pop() { |
| 1048 | match expr { |
| 1049 | Expr::BinaryExpr(BinaryExpr { |
| 1050 | right, |
| 1051 | op: Operator::And, |
| 1052 | left, |
| 1053 | }) => { |
| 1054 | stack.push(right); |
| 1055 | stack.push(left); |
| 1056 | } |
| 1057 | Expr::Alias(Alias { expr, .. }) => stack.push(expr), |
| 1058 | other => return Some(other), |
| 1059 | } |
| 1060 | } |
| 1061 | None |
| 1062 | }) |
| 1063 | } |
| 1064 | |
| 1065 | /// Iterate parts in a conjunctive [`Expr`] such as `A AND B AND C` => `[A, B, C]` |
| 1066 | /// |
no test coverage detected
searching dependent graphs…