vortex_scan/row_mask.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! A mask over a range of rows.
5
6use std::ops::Range;
7
8use vortex_mask::Mask;
9
10/// A RowMask captures a set of selected rows within a row range.
11///
12/// The range itself can be [`u64`], but the length of the range must fit into a [`usize`], this
13/// allows us to use a `usize` filter mask within a much larger file.
14#[derive(Debug, Clone)]
15pub struct RowMask {
16 row_offset: u64,
17 mask: Mask,
18}
19
20impl RowMask {
21 /// Create a new row range.
22 #[inline]
23 pub fn new(row_offset: u64, mask: Mask) -> Self {
24 Self { row_offset, mask }
25 }
26
27 #[inline]
28 /// The row range of the [`RowMask`].
29 pub fn row_range(&self) -> Range<u64> {
30 self.row_offset..self.row_offset + self.mask.len() as u64
31 }
32
33 /// The mask of the [`RowMask`].
34 #[inline]
35 pub fn mask(&self) -> &Mask {
36 &self.mask
37 }
38}