[][src]Function bisection::bisect_left_by

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

Return the index where a value 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, and all e in a[i..] have f(e) == Greater | f(e) == Equal

  • If a contains x, a.insert(i, x) will insert just before the leftmost x.