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 Range, which is always ascending. The (indexing) range values can be of any generic type T satisfying the listed bounds. Typically usize for searching efficiently in-memory, u128 for searching whole disks or internet, or f64 for solving equations. Comparator closure cmpr 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.