Function syunit::sub_unit_arrays

source ·
pub fn sub_unit_arrays<U, Rhs, const C: usize>(
    base: [U; C],
    rhs: [Rhs; C]
) -> [U::Output; C]
where U: Sub<Rhs> + Copy, Rhs: Copy,
Expand description

Subtract two arrays of units

§Example

A simple example would be subtracting some delta distances to some gamma distances

use syunit::*;
 
let gammas = [ Gamma(2.2), Gamma(1.0), Gamma(-3.5) ];
let deltas = [ Delta(1.2), Delta(3.5), Delta(0.5) ];
 
assert!(compare_unit_arrays(sub_unit_arrays(gammas, deltas), [ Gamma(1.0), Gamma(-2.5), Gamma(-4.0) ]));