vortex_scan/
row_mask.rs

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