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 where s is a String to search in a Vec<String>.
- Current API sometimes causes redundant allocations (e.g. when I have a
&str at hand, I need to allocate a String)
- 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 use Borrow always.
binary_search()takes a reference of the element instead of usingBorrowinstances. This is causing problems:&Stringdoesn't make any sense. I should be able to just use&swheresis aStringto search in aVec<String>.&strat hand, I need to allocate aString)Borrowfor this purpose. E.g.HashMap. As a guideline, I think lookup functions of containers should just useBorrowalways.