polars_expr::reduce

Trait Reducer

Source
pub trait Reducer:
    Send
    + Sync
    + Clone
    + 'static {
    type Dtype: PolarsDataType;
    type Value: Clone + Send + Sync + 'static;

    // Required methods
    fn init(&self) -> Self::Value;
    fn combine(&self, a: &mut Self::Value, b: &Self::Value);
    fn reduce_one(
        &self,
        a: &mut Self::Value,
        b: Option<<Self::Dtype as PolarsDataType>::Physical<'_>>,
    );
    fn reduce_ca(&self, v: &mut Self::Value, ca: &ChunkedArray<Self::Dtype>);
    fn finish(
        &self,
        v: Vec<Self::Value>,
        m: Option<Bitmap>,
        dtype: &DataType,
    ) -> PolarsResult<Series>;

    // Provided method
    fn cast_series<'a>(&self, s: &'a Series) -> Cow<'a, Series> { ... }
}

Required Associated Types§

Required Methods§

Source

fn init(&self) -> Self::Value

Source

fn combine(&self, a: &mut Self::Value, b: &Self::Value)

Source

fn reduce_one( &self, a: &mut Self::Value, b: Option<<Self::Dtype as PolarsDataType>::Physical<'_>>, )

Source

fn reduce_ca(&self, v: &mut Self::Value, ca: &ChunkedArray<Self::Dtype>)

Source

fn finish( &self, v: Vec<Self::Value>, m: Option<Bitmap>, dtype: &DataType, ) -> PolarsResult<Series>

Provided Methods§

Source

fn cast_series<'a>(&self, s: &'a Series) -> Cow<'a, Series>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§