pub trait Numeric: Copy + PartialOrd {
const DTYPE: DType;
const ZERO: Self;
const ONE: Self;
// Required methods
fn into_column(values: Vec<Self>) -> Column;
fn is_missing(self) -> bool;
fn to_f64(self) -> f64;
fn try_from_f64(x: f64) -> Option<Self>;
fn wrapping_add(self, other: Self) -> Self;
fn wrapping_sub(self, other: Self) -> Self;
fn wrapping_mul(self, other: Self) -> Self;
fn wrapping_abs(self) -> Self;
}Expand description
A numeric column element type. Implemented for f64 and i64; adding i32 /
f32 / u64 later is just another impl plus a dispatch arm.
Required Associated Constants§
Required Methods§
Sourcefn into_column(values: Vec<Self>) -> Column
fn into_column(values: Vec<Self>) -> Column
Wrap a computed buffer back into a Column of this element’s dtype.
Sourcefn is_missing(self) -> bool
fn is_missing(self) -> bool
Whether this element is the missing sentinel (NaN for f64; never i64).
Sourcefn try_from_f64(x: f64) -> Option<Self>
fn try_from_f64(x: f64) -> Option<Self>
Narrow from f64 losslessly, or None when the value would not fit
(non-integral / out of range / NaN for i64). Powers the keep-vs-promote
decision in clip / where / mask / assignment.
Sourcefn wrapping_add(self, other: Self) -> Self
fn wrapping_add(self, other: Self) -> Self
Wrapping add (matches pandas/numpy int64 overflow; plain + for f64).
Sourcefn wrapping_sub(self, other: Self) -> Self
fn wrapping_sub(self, other: Self) -> Self
Wrapping subtract.
Sourcefn wrapping_mul(self, other: Self) -> Self
fn wrapping_mul(self, other: Self) -> Self
Wrapping multiply.
Sourcefn wrapping_abs(self) -> Self
fn wrapping_abs(self) -> Self
Wrapping absolute value (abs(i64::MIN) == i64::MIN, like pandas).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".