pub trait VectorExtensions<T> {
// Required methods
fn monotonic_prop(&self) -> Monotonic;
fn get_lower_index(&self, x: T) -> usize;
}
Expand description
Helper methods for one dimensional numeric arrays
Required Methods§
Sourcefn monotonic_prop(&self) -> Monotonic
fn monotonic_prop(&self) -> Monotonic
get the monotonic property of the vector
Sourcefn get_lower_index(&self, x: T) -> usize
fn get_lower_index(&self, x: T) -> usize
Get the index of the next lower value inside the vector. This is not guaranteed to return the index of an exact match.
This will never return the last index of the vector.
when x is out of bounds it will either return 0
or self.len() - 2
depending on which side it is out of bounds
§Warning
this method requires the monotonic_prop
to be
Monotonic::Rising { strict: true }
otherwise the behaviour is undefined