arrow::datatypes

Trait ArrowNativeTypeOp

pub trait ArrowNativeTypeOp: ArrowNativeType {
    const ZERO: Self;
    const ONE: Self;
    const MIN_TOTAL_ORDER: Self;
    const MAX_TOTAL_ORDER: Self;
Show 22 methods // Required methods fn add_checked(self, rhs: Self) -> Result<Self, ArrowError>; fn add_wrapping(self, rhs: Self) -> Self; fn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>; fn sub_wrapping(self, rhs: Self) -> Self; fn mul_checked(self, rhs: Self) -> Result<Self, ArrowError>; fn mul_wrapping(self, rhs: Self) -> Self; fn div_checked(self, rhs: Self) -> Result<Self, ArrowError>; fn div_wrapping(self, rhs: Self) -> Self; fn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>; fn mod_wrapping(self, rhs: Self) -> Self; fn neg_checked(self) -> Result<Self, ArrowError>; fn neg_wrapping(self) -> Self; fn pow_checked(self, exp: u32) -> Result<Self, ArrowError>; fn pow_wrapping(self, exp: u32) -> Self; fn is_zero(self) -> bool; fn compare(self, rhs: Self) -> Ordering; fn is_eq(self, rhs: Self) -> bool; // Provided methods fn is_ne(self, rhs: Self) -> bool { ... } fn is_lt(self, rhs: Self) -> bool { ... } fn is_le(self, rhs: Self) -> bool { ... } fn is_gt(self, rhs: Self) -> bool { ... } fn is_ge(self, rhs: Self) -> bool { ... }
}
Expand description

Trait for ArrowNativeType that adds checked and unchecked arithmetic operations, and totally ordered comparison operations

The APIs with _wrapping suffix do not perform overflow-checking. For integer types they will wrap around the boundary of the type. For floating point types they will overflow to INF or -INF preserving the expected sign value

Note div_wrapping and mod_wrapping will panic for integer types if rhs is zero although this may be subject to change https://github.com/apache/arrow-rs/issues/2647

The APIs with _checked suffix perform overflow-checking. For integer types these will return Err instead of wrapping. For floating point types they will overflow to INF or -INF preserving the expected sign value

Comparison of integer types is as per normal integer comparison rules, floating point values are compared as per IEEE 754’s totalOrder predicate see f32::total_cmp

Required Associated Constants§

const ZERO: Self

The additive identity

const ONE: Self

The multiplicative identity

const MIN_TOTAL_ORDER: Self

The minimum value and identity for the max aggregation. Note that the aggregation uses the total order predicate for floating point values, which means that this value is a negative NaN.

const MAX_TOTAL_ORDER: Self

The maximum value and identity for the min aggregation. Note that the aggregation uses the total order predicate for floating point values, which means that this value is a positive NaN.

Required Methods§

fn add_checked(self, rhs: Self) -> Result<Self, ArrowError>

Checked addition operation

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

Wrapping addition operation

fn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>

Checked subtraction operation

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

Wrapping subtraction operation

fn mul_checked(self, rhs: Self) -> Result<Self, ArrowError>

Checked multiplication operation

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

Wrapping multiplication operation

fn div_checked(self, rhs: Self) -> Result<Self, ArrowError>

Checked division operation

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

Wrapping division operation

fn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>

Checked remainder operation

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

Wrapping remainder operation

fn neg_checked(self) -> Result<Self, ArrowError>

Checked negation operation

fn neg_wrapping(self) -> Self

Wrapping negation operation

fn pow_checked(self, exp: u32) -> Result<Self, ArrowError>

Checked exponentiation operation

fn pow_wrapping(self, exp: u32) -> Self

Wrapping exponentiation operation

fn is_zero(self) -> bool

Returns true if zero else false

fn compare(self, rhs: Self) -> Ordering

Compare operation

fn is_eq(self, rhs: Self) -> bool

Equality operation

Provided Methods§

fn is_ne(self, rhs: Self) -> bool

Not equal operation

fn is_lt(self, rhs: Self) -> bool

Less than operation

fn is_le(self, rhs: Self) -> bool

Less than equals operation

fn is_gt(self, rhs: Self) -> bool

Greater than operation

fn is_ge(self, rhs: Self) -> bool

Greater than equals operation

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§

§

impl ArrowNativeTypeOp for f32

§

const ZERO: f32 = 0f32

§

const ONE: f32 = 1f32

§

const MIN_TOTAL_ORDER: f32 = NaN_f32

§

const MAX_TOTAL_ORDER: f32 = NaN_f32

§

fn add_checked(self, rhs: f32) -> Result<f32, ArrowError>

§

fn add_wrapping(self, rhs: f32) -> f32

§

fn sub_checked(self, rhs: f32) -> Result<f32, ArrowError>

§

fn sub_wrapping(self, rhs: f32) -> f32

§

fn mul_checked(self, rhs: f32) -> Result<f32, ArrowError>

§

fn mul_wrapping(self, rhs: f32) -> f32

§

fn div_checked(self, rhs: f32) -> Result<f32, ArrowError>

§

fn div_wrapping(self, rhs: f32) -> f32

§

fn mod_checked(self, rhs: f32) -> Result<f32, ArrowError>

§

fn mod_wrapping(self, rhs: f32) -> f32

§

fn neg_checked(self) -> Result<f32, ArrowError>

§

fn neg_wrapping(self) -> f32

§

fn pow_checked(self, exp: u32) -> Result<f32, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> f32

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: f32) -> Ordering

§

fn is_eq(self, rhs: f32) -> bool

§

impl ArrowNativeTypeOp for f64

§

const ZERO: f64 = 0f64

§

const ONE: f64 = 1f64

§

const MIN_TOTAL_ORDER: f64 = NaN_f64

§

const MAX_TOTAL_ORDER: f64 = NaN_f64

§

fn add_checked(self, rhs: f64) -> Result<f64, ArrowError>

§

fn add_wrapping(self, rhs: f64) -> f64

§

fn sub_checked(self, rhs: f64) -> Result<f64, ArrowError>

§

fn sub_wrapping(self, rhs: f64) -> f64

§

fn mul_checked(self, rhs: f64) -> Result<f64, ArrowError>

§

fn mul_wrapping(self, rhs: f64) -> f64

§

fn div_checked(self, rhs: f64) -> Result<f64, ArrowError>

§

fn div_wrapping(self, rhs: f64) -> f64

§

fn mod_checked(self, rhs: f64) -> Result<f64, ArrowError>

§

fn mod_wrapping(self, rhs: f64) -> f64

§

fn neg_checked(self) -> Result<f64, ArrowError>

§

fn neg_wrapping(self) -> f64

§

fn pow_checked(self, exp: u32) -> Result<f64, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> f64

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: f64) -> Ordering

§

fn is_eq(self, rhs: f64) -> bool

§

impl ArrowNativeTypeOp for i8

§

const ZERO: i8 = 0i8

§

const ONE: i8 = 1i8

§

const MIN_TOTAL_ORDER: i8 = -128i8

§

const MAX_TOTAL_ORDER: i8 = 127i8

§

fn add_checked(self, rhs: i8) -> Result<i8, ArrowError>

§

fn add_wrapping(self, rhs: i8) -> i8

§

fn sub_checked(self, rhs: i8) -> Result<i8, ArrowError>

§

fn sub_wrapping(self, rhs: i8) -> i8

§

fn mul_checked(self, rhs: i8) -> Result<i8, ArrowError>

§

fn mul_wrapping(self, rhs: i8) -> i8

§

fn div_checked(self, rhs: i8) -> Result<i8, ArrowError>

§

fn div_wrapping(self, rhs: i8) -> i8

§

fn mod_checked(self, rhs: i8) -> Result<i8, ArrowError>

§

fn mod_wrapping(self, rhs: i8) -> i8

§

fn neg_checked(self) -> Result<i8, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<i8, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> i8

§

fn neg_wrapping(self) -> i8

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: i8) -> Ordering

§

fn is_eq(self, rhs: i8) -> bool

§

impl ArrowNativeTypeOp for i16

§

const ZERO: i16 = 0i16

§

const ONE: i16 = 1i16

§

const MIN_TOTAL_ORDER: i16 = -32_768i16

§

const MAX_TOTAL_ORDER: i16 = 32_767i16

§

fn add_checked(self, rhs: i16) -> Result<i16, ArrowError>

§

fn add_wrapping(self, rhs: i16) -> i16

§

fn sub_checked(self, rhs: i16) -> Result<i16, ArrowError>

§

fn sub_wrapping(self, rhs: i16) -> i16

§

fn mul_checked(self, rhs: i16) -> Result<i16, ArrowError>

§

fn mul_wrapping(self, rhs: i16) -> i16

§

fn div_checked(self, rhs: i16) -> Result<i16, ArrowError>

§

fn div_wrapping(self, rhs: i16) -> i16

§

fn mod_checked(self, rhs: i16) -> Result<i16, ArrowError>

§

fn mod_wrapping(self, rhs: i16) -> i16

§

fn neg_checked(self) -> Result<i16, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<i16, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> i16

§

fn neg_wrapping(self) -> i16

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: i16) -> Ordering

§

fn is_eq(self, rhs: i16) -> bool

§

impl ArrowNativeTypeOp for i32

§

const ZERO: i32 = 0i32

§

const ONE: i32 = 1i32

§

const MIN_TOTAL_ORDER: i32 = -2_147_483_648i32

§

const MAX_TOTAL_ORDER: i32 = 2_147_483_647i32

§

fn add_checked(self, rhs: i32) -> Result<i32, ArrowError>

§

fn add_wrapping(self, rhs: i32) -> i32

§

fn sub_checked(self, rhs: i32) -> Result<i32, ArrowError>

§

fn sub_wrapping(self, rhs: i32) -> i32

§

fn mul_checked(self, rhs: i32) -> Result<i32, ArrowError>

§

fn mul_wrapping(self, rhs: i32) -> i32

§

fn div_checked(self, rhs: i32) -> Result<i32, ArrowError>

§

fn div_wrapping(self, rhs: i32) -> i32

§

fn mod_checked(self, rhs: i32) -> Result<i32, ArrowError>

§

fn mod_wrapping(self, rhs: i32) -> i32

§

fn neg_checked(self) -> Result<i32, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<i32, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> i32

§

fn neg_wrapping(self) -> i32

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: i32) -> Ordering

§

fn is_eq(self, rhs: i32) -> bool

§

impl ArrowNativeTypeOp for i64

§

const ZERO: i64 = 0i64

§

const ONE: i64 = 1i64

§

const MIN_TOTAL_ORDER: i64 = -9_223_372_036_854_775_808i64

§

const MAX_TOTAL_ORDER: i64 = 9_223_372_036_854_775_807i64

§

fn add_checked(self, rhs: i64) -> Result<i64, ArrowError>

§

fn add_wrapping(self, rhs: i64) -> i64

§

fn sub_checked(self, rhs: i64) -> Result<i64, ArrowError>

§

fn sub_wrapping(self, rhs: i64) -> i64

§

fn mul_checked(self, rhs: i64) -> Result<i64, ArrowError>

§

fn mul_wrapping(self, rhs: i64) -> i64

§

fn div_checked(self, rhs: i64) -> Result<i64, ArrowError>

§

fn div_wrapping(self, rhs: i64) -> i64

§

fn mod_checked(self, rhs: i64) -> Result<i64, ArrowError>

§

fn mod_wrapping(self, rhs: i64) -> i64

§

fn neg_checked(self) -> Result<i64, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<i64, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> i64

§

fn neg_wrapping(self) -> i64

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: i64) -> Ordering

§

fn is_eq(self, rhs: i64) -> bool

§

impl ArrowNativeTypeOp for i128

§

const ZERO: i128 = 0i128

§

const ONE: i128 = 1i128

§

const MIN_TOTAL_ORDER: i128 = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

§

const MAX_TOTAL_ORDER: i128 = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

§

fn add_checked(self, rhs: i128) -> Result<i128, ArrowError>

§

fn add_wrapping(self, rhs: i128) -> i128

§

fn sub_checked(self, rhs: i128) -> Result<i128, ArrowError>

§

fn sub_wrapping(self, rhs: i128) -> i128

§

fn mul_checked(self, rhs: i128) -> Result<i128, ArrowError>

§

fn mul_wrapping(self, rhs: i128) -> i128

§

fn div_checked(self, rhs: i128) -> Result<i128, ArrowError>

§

fn div_wrapping(self, rhs: i128) -> i128

§

fn mod_checked(self, rhs: i128) -> Result<i128, ArrowError>

§

fn mod_wrapping(self, rhs: i128) -> i128

§

fn neg_checked(self) -> Result<i128, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<i128, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> i128

§

fn neg_wrapping(self) -> i128

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: i128) -> Ordering

§

fn is_eq(self, rhs: i128) -> bool

§

impl ArrowNativeTypeOp for u8

§

const ZERO: u8 = 0u8

§

const ONE: u8 = 1u8

§

const MIN_TOTAL_ORDER: u8 = 0u8

§

const MAX_TOTAL_ORDER: u8 = 255u8

§

fn add_checked(self, rhs: u8) -> Result<u8, ArrowError>

§

fn add_wrapping(self, rhs: u8) -> u8

§

fn sub_checked(self, rhs: u8) -> Result<u8, ArrowError>

§

fn sub_wrapping(self, rhs: u8) -> u8

§

fn mul_checked(self, rhs: u8) -> Result<u8, ArrowError>

§

fn mul_wrapping(self, rhs: u8) -> u8

§

fn div_checked(self, rhs: u8) -> Result<u8, ArrowError>

§

fn div_wrapping(self, rhs: u8) -> u8

§

fn mod_checked(self, rhs: u8) -> Result<u8, ArrowError>

§

fn mod_wrapping(self, rhs: u8) -> u8

§

fn neg_checked(self) -> Result<u8, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<u8, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> u8

§

fn neg_wrapping(self) -> u8

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: u8) -> Ordering

§

fn is_eq(self, rhs: u8) -> bool

§

impl ArrowNativeTypeOp for u16

§

const ZERO: u16 = 0u16

§

const ONE: u16 = 1u16

§

const MIN_TOTAL_ORDER: u16 = 0u16

§

const MAX_TOTAL_ORDER: u16 = 65_535u16

§

fn add_checked(self, rhs: u16) -> Result<u16, ArrowError>

§

fn add_wrapping(self, rhs: u16) -> u16

§

fn sub_checked(self, rhs: u16) -> Result<u16, ArrowError>

§

fn sub_wrapping(self, rhs: u16) -> u16

§

fn mul_checked(self, rhs: u16) -> Result<u16, ArrowError>

§

fn mul_wrapping(self, rhs: u16) -> u16

§

fn div_checked(self, rhs: u16) -> Result<u16, ArrowError>

§

fn div_wrapping(self, rhs: u16) -> u16

§

fn mod_checked(self, rhs: u16) -> Result<u16, ArrowError>

§

fn mod_wrapping(self, rhs: u16) -> u16

§

fn neg_checked(self) -> Result<u16, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<u16, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> u16

§

fn neg_wrapping(self) -> u16

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: u16) -> Ordering

§

fn is_eq(self, rhs: u16) -> bool

§

impl ArrowNativeTypeOp for u32

§

const ZERO: u32 = 0u32

§

const ONE: u32 = 1u32

§

const MIN_TOTAL_ORDER: u32 = 0u32

§

const MAX_TOTAL_ORDER: u32 = 4_294_967_295u32

§

fn add_checked(self, rhs: u32) -> Result<u32, ArrowError>

§

fn add_wrapping(self, rhs: u32) -> u32

§

fn sub_checked(self, rhs: u32) -> Result<u32, ArrowError>

§

fn sub_wrapping(self, rhs: u32) -> u32

§

fn mul_checked(self, rhs: u32) -> Result<u32, ArrowError>

§

fn mul_wrapping(self, rhs: u32) -> u32

§

fn div_checked(self, rhs: u32) -> Result<u32, ArrowError>

§

fn div_wrapping(self, rhs: u32) -> u32

§

fn mod_checked(self, rhs: u32) -> Result<u32, ArrowError>

§

fn mod_wrapping(self, rhs: u32) -> u32

§

fn neg_checked(self) -> Result<u32, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<u32, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> u32

§

fn neg_wrapping(self) -> u32

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: u32) -> Ordering

§

fn is_eq(self, rhs: u32) -> bool

§

impl ArrowNativeTypeOp for u64

§

const ZERO: u64 = 0u64

§

const ONE: u64 = 1u64

§

const MIN_TOTAL_ORDER: u64 = 0u64

§

const MAX_TOTAL_ORDER: u64 = 18_446_744_073_709_551_615u64

§

fn add_checked(self, rhs: u64) -> Result<u64, ArrowError>

§

fn add_wrapping(self, rhs: u64) -> u64

§

fn sub_checked(self, rhs: u64) -> Result<u64, ArrowError>

§

fn sub_wrapping(self, rhs: u64) -> u64

§

fn mul_checked(self, rhs: u64) -> Result<u64, ArrowError>

§

fn mul_wrapping(self, rhs: u64) -> u64

§

fn div_checked(self, rhs: u64) -> Result<u64, ArrowError>

§

fn div_wrapping(self, rhs: u64) -> u64

§

fn mod_checked(self, rhs: u64) -> Result<u64, ArrowError>

§

fn mod_wrapping(self, rhs: u64) -> u64

§

fn neg_checked(self) -> Result<u64, ArrowError>

§

fn pow_checked(self, exp: u32) -> Result<u64, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> u64

§

fn neg_wrapping(self) -> u64

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: u64) -> Ordering

§

fn is_eq(self, rhs: u64) -> bool

§

impl ArrowNativeTypeOp for f16

§

const ZERO: f16 = f16::ZERO

§

const ONE: f16 = f16::ONE

§

const MIN_TOTAL_ORDER: f16 = _

§

const MAX_TOTAL_ORDER: f16 = _

§

fn add_checked(self, rhs: f16) -> Result<f16, ArrowError>

§

fn add_wrapping(self, rhs: f16) -> f16

§

fn sub_checked(self, rhs: f16) -> Result<f16, ArrowError>

§

fn sub_wrapping(self, rhs: f16) -> f16

§

fn mul_checked(self, rhs: f16) -> Result<f16, ArrowError>

§

fn mul_wrapping(self, rhs: f16) -> f16

§

fn div_checked(self, rhs: f16) -> Result<f16, ArrowError>

§

fn div_wrapping(self, rhs: f16) -> f16

§

fn mod_checked(self, rhs: f16) -> Result<f16, ArrowError>

§

fn mod_wrapping(self, rhs: f16) -> f16

§

fn neg_checked(self) -> Result<f16, ArrowError>

§

fn neg_wrapping(self) -> f16

§

fn pow_checked(self, exp: u32) -> Result<f16, ArrowError>

§

fn pow_wrapping(self, exp: u32) -> f16

§

fn is_zero(self) -> bool

§

fn compare(self, rhs: f16) -> Ordering

§

fn is_eq(self, rhs: f16) -> bool

Implementors§

§

impl ArrowNativeTypeOp for IntervalDayTime

§

const ZERO: IntervalDayTime = IntervalDayTime::ZERO

§

const ONE: IntervalDayTime = IntervalDayTime::ONE

§

const MIN_TOTAL_ORDER: IntervalDayTime = IntervalDayTime::MIN

§

const MAX_TOTAL_ORDER: IntervalDayTime = IntervalDayTime::MAX

§

impl ArrowNativeTypeOp for IntervalMonthDayNano

§

const ZERO: IntervalMonthDayNano = IntervalMonthDayNano::ZERO

§

const ONE: IntervalMonthDayNano = IntervalMonthDayNano::ONE

§

const MIN_TOTAL_ORDER: IntervalMonthDayNano = IntervalMonthDayNano::MIN

§

const MAX_TOTAL_ORDER: IntervalMonthDayNano = IntervalMonthDayNano::MAX

§

impl ArrowNativeTypeOp for i256

§

const ZERO: i256 = i256::ZERO

§

const ONE: i256 = i256::ONE

§

const MIN_TOTAL_ORDER: i256 = i256::MIN

§

const MAX_TOTAL_ORDER: i256 = i256::MAX