Trait arrow::array::ArrowNativeTypeOp
source · 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§
sourceconst MIN_TOTAL_ORDER: Self
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.
sourceconst MAX_TOTAL_ORDER: Self
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§
sourcefn add_checked(self, rhs: Self) -> Result<Self, ArrowError>
fn add_checked(self, rhs: Self) -> Result<Self, ArrowError>
Checked addition operation
sourcefn add_wrapping(self, rhs: Self) -> Self
fn add_wrapping(self, rhs: Self) -> Self
Wrapping addition operation
sourcefn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>
fn sub_checked(self, rhs: Self) -> Result<Self, ArrowError>
Checked subtraction operation
sourcefn sub_wrapping(self, rhs: Self) -> Self
fn sub_wrapping(self, rhs: Self) -> Self
Wrapping subtraction operation
sourcefn mul_checked(self, rhs: Self) -> Result<Self, ArrowError>
fn mul_checked(self, rhs: Self) -> Result<Self, ArrowError>
Checked multiplication operation
sourcefn mul_wrapping(self, rhs: Self) -> Self
fn mul_wrapping(self, rhs: Self) -> Self
Wrapping multiplication operation
sourcefn div_checked(self, rhs: Self) -> Result<Self, ArrowError>
fn div_checked(self, rhs: Self) -> Result<Self, ArrowError>
Checked division operation
sourcefn div_wrapping(self, rhs: Self) -> Self
fn div_wrapping(self, rhs: Self) -> Self
Wrapping division operation
sourcefn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>
fn mod_checked(self, rhs: Self) -> Result<Self, ArrowError>
Checked remainder operation
sourcefn mod_wrapping(self, rhs: Self) -> Self
fn mod_wrapping(self, rhs: Self) -> Self
Wrapping remainder operation
sourcefn neg_checked(self) -> Result<Self, ArrowError>
fn neg_checked(self) -> Result<Self, ArrowError>
Checked negation operation
sourcefn neg_wrapping(self) -> Self
fn neg_wrapping(self) -> Self
Wrapping negation operation
sourcefn pow_checked(self, exp: u32) -> Result<Self, ArrowError>
fn pow_checked(self, exp: u32) -> Result<Self, ArrowError>
Checked exponentiation operation
sourcefn pow_wrapping(self, exp: u32) -> Self
fn pow_wrapping(self, exp: u32) -> Self
Wrapping exponentiation operation