Skip to main content

vortex_zigzag/
slice.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::ops::Range;
5
6use vortex_array::ArrayRef;
7use vortex_array::ArrayView;
8use vortex_array::IntoArray;
9use vortex_array::arrays::slice::SliceReduce;
10use vortex_error::VortexResult;
11
12use crate::ZigZag;
13use crate::array::ZigZagArrayExt;
14
15impl SliceReduce for ZigZag {
16    fn slice(array: ArrayView<'_, Self>, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
17        Ok(Some(
18            ZigZag::try_new(array.encoded().slice(range)?)?.into_array(),
19        ))
20    }
21}