pub fn validate_index( index: usize, max_index: usize, field_name: &str, ) -> Result<()>
Validate that an index is within bounds