Function indxvec::binary_find_any
source · [−]pub fn binary_find_any<T, F>(range: Range<T>, cmpr: &mut F) -> T where
T: PartialOrd + Copy + Add<Output = T> + Sub<Output = T> + Div<Output = T> + From<u8>,
F: FnMut(&T) -> Ordering,
Expand description
Generalised binary_search
for any one target.
Search within the specified Rangecmpr
is comparing against search target captured from its environment.
The sort order reflected by cmpr
can be either ascending or descending (increasing/decreasing).
When the target is in order before range.start, range.start is returned.
When the target is in order after range.end-1, range.end is returned.
Normally returns an index of the first hit target that is PartiallyEqual.
When the target is not present, then its insert position is returned.