(datums: I)
| 193 | } |
| 194 | |
| 195 | fn count<'a, I>(datums: I) -> Datum<'a> |
| 196 | where |
| 197 | I: IntoIterator<Item = (Datum<'a>, Diff)>, |
| 198 | { |
| 199 | // Count is accumulable: rather than expand each `(datum, diff)` into `diff` |
| 200 | // copies and count them, we sum the diffs directly. A net-negative count is |
| 201 | // possible (the surface does not define behavior in that case) and surfaces |
| 202 | // here as a negative result. |
| 203 | // TODO(jkosh44) This should error when the count can't fit inside of an `i64` instead of returning a negative result. |
| 204 | let mut count = Diff::ZERO; |
| 205 | for (datum, diff) in datums { |
| 206 | if !datum.is_null() { |
| 207 | count += diff; |
| 208 | } |
| 209 | } |
| 210 | Datum::from(count.into_inner()) |
| 211 | } |
| 212 | |
| 213 | fn any<'a, I>(datums: I) -> Datum<'a> |
| 214 | where |
no test coverage detected