[][src]Function bisection::bisect_right_by

pub fn bisect_right_by<T, F>(a: &[T], f: F) -> usize where
    F: FnMut(&T) -> Ordering

Return the index where x should be inserted in a, assuming a is sorted, according to a comparator function.

The comparator function should implement an order consistent with the sort order of the underlying slice, returning an order code that indicates whethers its argument is Less, Equal or Greater that the desired target.

The return value i is such that all e in a[..i] have f(e) == Less | f(e) == Equal, and all e in a[i..] have f(e) == Greater.

  • If a contains x, a.insert(i, x) will insert just after the rightmost occurence of x.