Function normalize_array_index

Source
fn normalize_array_index(len: usize, index: i32) -> Option<usize>
Expand description

Normalizes an array index to 0..len. Negative indices count from the end. i.e. -len..0 => 0..len. Returns None if index is out of bounds.