vortex_vector/
scalar_ops.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use crate::{Scalar, VectorMut, private};
5
6/// Trait for scalar operations.
7pub trait ScalarOps: private::Sealed + Sized + Into<Scalar> {
8    /// Returns true if the scalar is valid (not null).
9    fn is_valid(&self) -> bool;
10
11    /// Returns true if the scalar is null.
12    fn is_invalid(&self) -> bool {
13        !self.is_valid()
14    }
15
16    /// Creates a new vector with n repetitions of this scalar.
17    fn repeat(&self, n: usize) -> VectorMut;
18}