Closed
Description
binary_search()
takes a reference of the element instead of using Borrow
instances. This is causing problems:
&String
doesn't make any sense. I should be able to just use&s
wheres
is aString
to search in aVec<String>
.- Current API sometimes causes redundant allocations (e.g. when I have a
&str
at hand, I need to allocate aString
) - API is inconsistent in that some other containers use
Borrow
for this purpose. E.g.HashMap
. As a guideline, I think lookup functions of containers should just useBorrow
always.