Skip to main content

reifydb_column/
selection.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use reifydb_core::value::column::mask::RowMask;
5
6// Result of evaluating a predicate against a `ColumnBlock`.
7//
8// `None_` uses a trailing underscore so pattern matches don't shadow
9// `Option::None`.
10#[derive(Clone, Debug)]
11pub enum Selection {
12	All,
13	None_,
14	Mask(RowMask),
15}
16
17impl Selection {
18	pub fn is_all(&self) -> bool {
19		matches!(self, Self::All)
20	}
21
22	pub fn is_none(&self) -> bool {
23		matches!(self, Self::None_)
24	}
25
26	pub fn as_mask(&self) -> Option<&RowMask> {
27		match self {
28			Self::Mask(m) => Some(m),
29			_ => None,
30		}
31	}
32}