about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2014-04-28Deprecate the rev_iter pattern in all places where a DoubleEndedIterator is ↵Jonathan S-38/+39
provided (everywhere but treemap) This commit deprecates rev_iter, mut_rev_iter, move_rev_iter everywhere (except treemap) and also deprecates related functions like rsplit, rev_components, and rev_str_components. In every case, these functions can be replaced with the non-reversed form followed by a call to .rev(). To make this more concrete, a translation table for all functional changes necessary follows: * container.rev_iter() -> container.iter().rev() * container.mut_rev_iter() -> container.mut_iter().rev() * container.move_rev_iter() -> container.move_iter().rev() * sliceorstr.rsplit(sep) -> sliceorstr.split(sep).rev() * path.rev_components() -> path.components().rev() * path.rev_str_components() -> path.str_components().rev() In terms of the type system, this change also deprecates any specialized reversed iterator types (except in treemap), opting instead to use Rev directly if any type annotations are needed. However, since methods directly returning reversed iterators are now discouraged, the need for such annotations should be small. However, in those cases, the general pattern for conversion is to take whatever follows Rev in the original reversed name and surround it with Rev<>: * RevComponents<'a> -> Rev<Components<'a>> * RevStrComponents<'a> -> Rev<StrComponents<'a>> * RevItems<'a, T> -> Rev<Items<'a, T>> * etc. The reasoning behind this change is that it makes the standard API much simpler without reducing readability, performance, or power. The presence of functions such as rev_iter adds more boilerplate code to libraries (all of which simply call .iter().rev()), clutters up the documentation, and only helps code by saving two characters. Additionally, the numerous type synonyms that were used to make the type signatures look nice like RevItems add even more boilerplate and clutter up the docs even more. With this change, all that cruft goes away. [breaking-change]
2014-04-23std: Change RandomAccessIterator to use `&mut self`Alex Crichton-2/+2
Many iterators go through a closure when dealing with the `idx` method, which are invalid after the previous change (closures cannot be invoked through a `&` pointer). This commit alters the `fn idx` method on the RandomAccessIterator to take `&mut self` rather than `&self`. [breaking-change]
2014-04-22auto merge of #13653 : jbcrail/rust/fix-comment-mistakes, r=alexcrichtonbors-8/+8
2014-04-22auto merge of #13646 : cgaebel/rust/hashmap-cleanup, r=alexcrichtonbors-112/+168
I went through the HashMap module, fixed spelling mistakes, minor inefficiencies, added tests, and other trivial changes. Hopefully this won't be a controversial PR.
2014-04-21auto merge of #13618 : yuriks/rust/lru-cache, r=brsonbors-58/+35
Just a few space saving optimizations that end up making the code less cluttered too. I'd like to someone to review the last commit closely, I don't have much experience with writing unsafe code, I had someone walk me through how to use cast::forget in IRC.
2014-04-21Just some general cleanup in the HashMap moduleClark Gaebel-112/+168
I went through the HashMap module, fixed spelling mistakes, minor inefficiencies, added tests, and other trivial changes.
2014-04-21Fix misspellings in comments.Joseph Crail-8/+8
2014-04-19Eliminate the need for Options in LruEntry.Yuri Kunde Schlesner-42/+21
LruEntry nodes previously used Option to encapsulate the key and value fields. This was used merely as a way avoid having values for the sigil node. Apart from wasting a few bytes for the discriminant, this cluttered the rest of the code, since these fields always contained Some on regular nodes as a class invariant. The Option wrapping was removed, and the values in the sigil field are initialized using mem::init, so that they don't contain any real data.
2014-04-19auto merge of #13614 : cgaebel/rust/master, r=brsonbors-30/+66
We previously allocated 3x for every HashMap creation and resize. This patch reduces it to 1x.
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-69/+69
2014-04-18Reduce HashMap allocations.Clark Gaebel-30/+66
2014-04-18Eliminate unecessary extra sigil node from LruCache.Yuri Kunde Schlesner-6/+3
Instead of allocating both head and tail nodes for the ends of the node list, a single node can be allocated and linked circularly instead, making it act as both the head and the tail of the list at the same time.
2014-04-18Remove redundant variable in LruCache::putYuri Kunde Schlesner-11/+12
2014-04-17Simplify implementation of Bitv::{all,none} using iter builtins.Yuri Kunde Schlesner-8/+2
2014-04-17Give reduction-type tests in Bitv more natural namesYuri Kunde Schlesner-6/+57
2014-04-15More default impl and docs removal in treemapSteven Fackler-27/+0
2014-04-15Add a default impl for Set::is_supersetSteven Fackler-43/+8
I also deleted a bunch of documentation that was copy/pasted from the trait definition.
2014-04-11libtest: rename `BenchHarness` to `Bencher`Liigo Zhuang-96/+96
Closes #12640
2014-04-10auto merge of #13440 : huonw/rust/strbuf, r=alexcrichtonbors-73/+123
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it. Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-11Fix tests. Add Vec<u8> conversion to StrBuf.Huon Wilson-2/+10
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-73/+115
port all code over to use it.
2014-04-09collections: replace all ~[T] with Vec<T>.Huon Wilson-213/+212
2014-04-08Register new snapshotsAlex Crichton-1/+1
2014-04-06auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,mebors-1/+2
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-04Register new snapshotsAlex Crichton-2/+0
2014-04-04extra: Add with_capacity to PriorityQueue and SmallIntMapErick Tryzelaar-0/+10
2014-04-04std: TrieSet should implement container::{,Mutable}SetErick Tryzelaar-13/+27
2014-04-04Fix fallout from std::libc separationCorey Richardson-1/+2
2014-04-03Bump version to 0.11-preBrian Anderson-1/+1
This also changes some of the download links in the documentation to 'nightly'.
2014-04-03auto merge of #13286 : alexcrichton/rust/release, r=brsonbors-1/+1
Merging the 0.10 release into the master branch.
2014-04-02Fix fallout of requiring uint indicesAlex Crichton-9/+9
2014-04-01auto merge of #13115 : huonw/rust/rand-errors, r=alexcrichtonbors-2/+2
move errno -> IoError converter into std, bubble up OSRng errors Also adds a general errno -> `~str` converter to `std::os`, and makes the failure messages for the things using `OSRng` (e.g. (transitively) the task-local RNG, meaning hashmap initialisation failures aren't such a black box).
2014-04-01rand: bubble up IO messages futher.Huon Wilson-2/+2
The various ...Rng::new() methods can hit IO errors from the OSRng they use, and it seems sensible to expose them at a higher level. Unfortunately, writing e.g. `StdRng::new().unwrap()` gives a much poorer error message than if it failed internally, but this is a problem with all `IoResult`s.
2014-03-31collections: Switch field privacy as necessaryAlex Crichton-110/+112
2014-03-31Bump version to 0.10Alex Crichton-1/+1
2014-03-30Rename `from_iterator` to `from_iter` for consistency.Brian Anderson-10/+10
2014-03-30Updated references to extra in libcollections docsScott Jenkins-3/+3
2014-03-29auto merge of #13183 : erickt/rust/remove-list, r=alexcrichtonbors-239/+0
`collections::list::List` was decided in a [team meeting](https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25) that it was unnecessary, so this PR removes it. Additionally, it removes an old and redundant purity test and fixes some warnings.
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-11/+11
Closes #2569
2014-03-28collections: remove ListErick Tryzelaar-239/+0
It was decided in a meeting that this module wasn't needed, and more thought should be put into a persistent collections library.
2014-03-28Rename Pod into CopyFlavio Percoco-7/+7
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-28/+27
value
2014-03-23auto merge of #13102 : huonw/rust/totaleq-deriving, r=thestingerbors-44/+13
std: remove the `equals` method from `TotalEq`. `TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-44/+13
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-23Register new snapshotsFlavio Percoco-1/+0
2014-03-23use TotalEq for HashMapDaniel Micay-35/+34
Closes #5283
2014-03-20Register new snapshotsAlex Crichton-4/+1
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-3/+3
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-27/+27
Closes #12702