polars_compute::arithmetic::pl_num

Trait PlNumArithmetic

Source
pub trait PlNumArithmetic:
    Sized
    + Copy
    + 'static {
    type TrueDivT: NativeType;

    // Required methods
    fn wrapping_abs(self) -> Self;
    fn wrapping_neg(self) -> Self;
    fn wrapping_add(self, rhs: Self) -> Self;
    fn wrapping_sub(self, rhs: Self) -> Self;
    fn wrapping_mul(self, rhs: Self) -> Self;
    fn wrapping_floor_div(self, rhs: Self) -> Self;
    fn wrapping_trunc_div(self, rhs: Self) -> Self;
    fn wrapping_mod(self, rhs: Self) -> Self;
    fn true_div(self, rhs: Self) -> Self::TrueDivT;

    // Provided method
    fn legacy_div(self, rhs: Self) -> Self { ... }
}
Expand description

Implements basic arithmetic between scalars with the same behavior as ArithmeticKernel.

Note, however, that the user is responsible for setting the validity of results for e.g. div/mod operations with 0 in the denominator.

This is intended as a low-level utility for custom arithmetic loops (e.g. in list arithmetic). In most cases prefer using ArithmeticKernel or ArithmeticChunked instead.

Required Associated Types§

Required Methods§

Source

fn wrapping_abs(self) -> Self

Source

fn wrapping_neg(self) -> Self

Source

fn wrapping_add(self, rhs: Self) -> Self

Source

fn wrapping_sub(self, rhs: Self) -> Self

Source

fn wrapping_mul(self, rhs: Self) -> Self

Source

fn wrapping_floor_div(self, rhs: Self) -> Self

Source

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source

fn wrapping_mod(self, rhs: Self) -> Self

Source

fn true_div(self, rhs: Self) -> Self::TrueDivT

Provided Methods§

Source

fn legacy_div(self, rhs: Self) -> Self

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.

Implementations on Foreign Types§

Source§

impl PlNumArithmetic for f32

Source§

type TrueDivT = f32

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for f64

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for i8

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for i16

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for i32

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for i64

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for i128

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for u8

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for u16

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for u32

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for u64

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Source§

impl PlNumArithmetic for u128

Source§

type TrueDivT = f64

Source§

fn wrapping_abs(self) -> Self

Source§

fn wrapping_neg(self) -> Self

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

fn wrapping_mul(self, rhs: Self) -> Self

Source§

fn wrapping_floor_div(self, rhs: Self) -> Self

Source§

fn wrapping_trunc_div(self, rhs: Self) -> Self

Source§

fn wrapping_mod(self, rhs: Self) -> Self

Source§

fn true_div(self, rhs: Self) -> Self::TrueDivT

Implementors§