vortex_array/
offset.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use num_traits::{AsPrimitive, PrimInt};
5use vortex_dtype::NativePType;
6use vortex_scalar::Scalar;
7
8// TODO(connor)[ListView]: Replace the bottom `ListBuilder` with `ListViewBuilder`
9/// A trait bound for integer types that can represent offsets.
10///
11/// This is mainly used in the builders [`ListBuilder`] and [`ListViewBuilder`].
12///
13/// [`ListBuilder`]: crate::builders::ListBuilder
14/// [`ListViewBuilder`]: crate::builders::ListBuilder
15pub trait OffsetPType: NativePType + PrimInt + AsPrimitive<usize> + Into<Scalar> {}
16
17/// Implements [`OffsetPType`] for all possible `T` that have the correct bounds.
18impl<T> OffsetPType for T where T: NativePType + PrimInt + AsPrimitive<usize> + Into<Scalar> {}