What we have in C++
C++ has two STL functions: std::lower_bound and std::upper_bound
std::lower_bound finds first position of searched value if it exists, or position of first value greater.
std::upper_bound finds first position with greater value than requested.
Together this functions allows user to find half open iterator range which contains all values equal to searched one.
In Rust
In Rust we have only binary_search for slices with some extra predicates but it can return any positions where value equal to searched one.
How I can find first value index or last value index + 1 like in C++?