binary_search is only available for slices. Sometimes the data is not convertible to a slice, but traits could be implemented.
Motivation
It would be nice to enable core features like the binary_search algorithm on the data by just implementing the required traits.
Detailed design
The traits for binary_search would need random access to the elements (core::ops::Index) and the length (is there a trait?)
Currently a custom binary search implementation would be required, if the data structure is not convertible to a slice.
Like mentioned below, these could be grouped like in D, into something like a SortedRange Trait.
Alternatives
This does not necessarily need to be part of the rust core. It could also be moved to a separate crate. Although it is nice to have reliable methods in the core libraries.
Yes, but from the language perspective there is probably not much we could do about that, except bundle methods like binary_search into something like a SortedRange trait?