summary refs log tree commit diff
path: root/src/libcoretest/slice.rs
AgeCommit message (Collapse)AuthorLines
2015-08-12O(1) count,nth,last for slice::Windows,Chunks(Mut)Alex Ozdemir-0/+120
Implemented count, nth, and last in constant time for Windows, Chunks, and ChunksMut created from a slice. Included checks for overflow in the implementation of nth(). Also added a test for each implemented method to libcoretest. Addresses #24214
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-49/+0
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-04-22Implement O(1) slice::Iter methods.Steven Allen-0/+31
Instead of using the O(n) defaults, define O(1) shortcuts.
2015-02-26remove some compiler warningsTshepang Lekhonkhobe-3/+3
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-6/+6
2015-01-30Remove all `i` suffixesTobias Bucher-10/+10
2015-01-07use slicing sugarJorge Aparicio-3/+3
2015-01-07falloutNick Cameron-8/+8
2015-01-07Replace full slice notation with index callsNick Cameron-7/+7
2014-12-30Fallout from stabilizationAaron Turon-11/+11
2014-11-26Test fixes and rebase conflictsAlex Crichton-1/+1
2014-11-25Add methods to go from a slice iterators to a slice.Huon Wilson-0/+49
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-08-13core: Add binary_search and binary_search_elem methods to slices.Brian Anderson-0/+35
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.