pub trait SliceDifferentiate<T>: Slice<Item = T> {
// Required method
const fn differentiate(&mut self)
where T: SubAssign<T> + Copy;
}Required Methods§
Sourceconst fn differentiate(&mut self)
const fn differentiate(&mut self)
Differentiates the slice in-place.
Each value will be subtracted by the previous value.
It’s assumed that the first value of the slice is preceded by zeros.
§Example
use slice_ops::ops::*;
let mut x = [1, 5, 5, 6, 2, -1, 0, 0, 0];
x.differentiate();
assert_eq!(x, [1, 4, 0, 1, -4, -3, 1, 0, 0]);
x.integrate();
assert_eq!(x, [1, 5, 5, 6, 2, -1, 0, 0, 0]);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.