polars_core::prelude

Trait SlicedArray

pub trait SlicedArray {
    // Required methods
    fn slice_typed(&self, offset: usize, length: usize) -> Self
       where Self: Sized;
    unsafe fn slice_typed_unchecked(&self, offset: usize, length: usize) -> Self
       where Self: Sized;
}
Expand description

Utility trait to slice concrete arrow arrays whilst keeping their concrete type. E.g. don’t return Box<dyn Array>.

Required Methods§

fn slice_typed(&self, offset: usize, length: usize) -> Self
where Self: Sized,

Slices this [Array].

§Implementation

This operation is O(1) over len.

§Panic

This function panics iff offset + length > self.len().

unsafe fn slice_typed_unchecked(&self, offset: usize, length: usize) -> Self
where Self: Sized,

Slices the [Array].

§Implementation

This operation is O(1).

§Safety

The caller must ensure that offset + length <= self.len()

Implementors§

§

impl<T> SlicedArray for T
where T: Array + Clone,