polars_core::prelude

Trait SlicedArray

Source
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§

Source

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().

Source

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§

Source§

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