Function arrow2::compute::arithmetics::basic::wrapping_add_scalar
source · [−]pub fn wrapping_add_scalar<T>(
lhs: &PrimitiveArray<T>,
rhs: &T
) -> PrimitiveArray<T> where
T: NativeArithmetics + WrappingAdd<Output = T>,
Expand description
Wrapping addition of a scalar T to a PrimitiveArray
of type T.
It do nothing if the result overflows.
Examples
use arrow2::compute::arithmetics::basic::wrapping_add_scalar;
use arrow2::array::Int8Array;
let a = Int8Array::from(&[None, Some(100)]);
let result = wrapping_add_scalar(&a, &100i8);
let expected = Int8Array::from(&[None, Some(-56)]);
assert_eq!(result, expected);