Skip to main content

classify_dense_permutation

Function classify_dense_permutation 

Source
pub fn classify_dense_permutation(
    sorted_indices: &[usize],
    expected_len: usize,
) -> Result<(), DensePermutationDefect>
Expand description

Classify whether sorted_indices is a dense permutation of 0..expected_len : each value in 0..expected_len present exactly once.

Callers MUST pass indices already sorted ascending (e.g. via sort_unstable_if_needed); the classification is defined on sorted slot position. This is the single source of the dense-index-map invariant shared by every resident/graph descriptor→logical-slot map; format the returned DensePermutationDefect into a context-specific message at the call site.