pub fn try_slice(
array: &ArrayRef,
offset: usize,
len: usize,
) -> Result<ArrayRef>Expand description
Checked slicing for any array.
ยงErrors
DataError::SliceOutOfBounds when the window leaves the array.
use astrs_data::array::{try_slice, Int32Array, IntoArrayRef};
let column = Int32Array::from_values([1, 2, 3]).into_array_ref();
assert_eq!(try_slice(&column, 1, 2)?.len(), 2);
assert!(try_slice(&column, 2, 2).is_err());