Skip to main content

nth_tuple

Function nth_tuple 

Source
fn nth_tuple(lists: &[Vec<(ItemId, String)>], i: usize) -> Vec<(ItemId, String)>
Expand description

The i-th line of the Cartesian product of lists (outer category first), by mixed-radix decoding of i across the list lengths — the inner (last) category is the least-significant digit, matching axis_tuples’ ordering (which increments the inner category fastest). Returns the bound (ItemId, name) per category.

§Panics

i must be < product_len(lists), which implies every list is non-empty. A list filtered to zero items means the axis has NO lines, so there is no i-th line to decode; callers (grid_dims, render_grid, cursor_key) render zero lines in that case rather than calling here. The check is a hard assert! (not debug_assert!) because i % 0 is a divide-by-zero crash in release builds.

This is what lets the grid virtualize rows: instead of holding every row tuple in a Vec, we decode line i (and, for group outlining, line i-1) only when that row is actually painted.