fn count_within_budget<'a, T: DataType>(
n: usize,
byte_budget: usize,
vals: impl Iterator<Item = Option<&'a T::T>>,
) -> Option<usize>where
T::T: 'a,Expand description
How many leading values fit in byte_budget bytes, shared by the two
ColumnValueEncoder::count_values_within_byte_budget* methods (one walks a
contiguous slice, the other gathers by index).
n is the answer when everything fits; vals yields each candidate value,
or None for a position that should still be counted but contributes no
bytes (an out-of-range gather index). The boundary value that crosses the
budget is included in the count so the caller’s page-flush check trips on
this mini-batch rather than leaving a sliver for the next page; this also
catches a lone outlier wherever it lands among small values.
Defined at the end of the module alongside plain_encoded_byte_size for
the same reason — see that function’s note on code placement and the
string / string_and_binary_view benchmarks.