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§
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 Methods§
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.