vortex-scan 0.68.0

Scanning operations for Vortex
Documentation
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! A mask over a range of rows.

use std::ops::Range;

use vortex_mask::Mask;

/// A RowMask captures a set of selected rows within a row range.
///
/// The range itself can be [`u64`], but the length of the range must fit into a [`usize`], this
/// allows us to use a `usize` filter mask within a much larger file.
#[derive(Debug, Clone)]
pub struct RowMask {
    row_offset: u64,
    mask: Mask,
}

impl RowMask {
    /// Create a new row range.
    #[inline]
    pub fn new(row_offset: u64, mask: Mask) -> Self {
        Self { row_offset, mask }
    }

    #[inline]
    /// The row range of the [`RowMask`].
    pub fn row_range(&self) -> Range<u64> {
        self.row_offset..self.row_offset + self.mask.len() as u64
    }

    /// The mask of the [`RowMask`].
    #[inline]
    pub fn mask(&self) -> &Mask {
        &self.mask
    }
}