Commit Graph

6 Commits

Author SHA1 Message Date
Nick Cameron
0c7f7a5fb8 fallout 2015-01-07 12:02:52 +13:00
Nick Cameron
f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Aaron Turon
6abfac083f Fallout from stabilization 2014-12-30 17:06:08 -08:00
Alex Crichton
60541cdc1e Test fixes and rebase conflicts 2014-11-26 16:50:13 -08:00
Huon Wilson
b86a7808c7 Add methods to go from a slice iterators to a slice.
A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.
2014-11-25 17:10:32 +11:00
Brian Anderson
a4b354ca02 core: Add binary_search and binary_search_elem methods to slices.
These are like the existing bsearch methods but if the search fails,
it returns the next insertion point.

The new `binary_search` returns a `BinarySearchResult` that is either
`Found` or `NotFound`. For convenience, the `found` and `not_found`
methods convert to `Option`, ala `Result`.

Deprecate bsearch and bsearch_elem.
2014-08-13 11:30:15 -07:00