Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/compute/sort/row/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ pub struct Rows {

impl Rows {
/// Get a reference to a certain row.
///
/// # Panics
///
/// Panics if `row` is out of bounds
pub fn row(&self, row: usize) -> Row<'_> {
let end = self.offsets[row + 1];
let start = self.offsets[row];
Expand All @@ -269,7 +273,12 @@ impl Rows {
}

/// Get a reference to a certain row but not check the bounds.
pub fn row_unchecked(&self, row: usize) -> Row<'_> {
///
/// # Safety
///
/// The caller must ensure that `row` is within bounds
pub unsafe fn row_unchecked(&self, row: usize) -> Row<'_> {
debug_assert!(row < self.len(), "out-of-bounds access");
let data = unsafe {
let end = *self.offsets.get_unchecked(row + 1);
let start = *self.offsets.get_unchecked(row);
Expand Down Expand Up @@ -319,7 +328,7 @@ impl<'a> Iterator for RowsIter<'a> {
#[inline]
fn next(&mut self) -> Option<Self::Item> {
if self.start < self.end {
let row = self.rows.row_unchecked(self.start);
let row = unsafe { self.rows.row_unchecked(self.start) };
self.start += 1;
Some(row)
} else {
Expand Down