about summary refs log tree commit diff
path: root/src/libstd/hashmap.rs
AgeCommit message (Collapse)AuthorLines
2013-08-15std: Move the iterator param on FromIterator and Extendable to the method.Huon Wilson-8/+8
If they are on the trait then it is extremely annoying to use them as generic parameters to a function, e.g. with the iterator param on the trait itself, if one was to pass an Extendable<int> to a function that filled it either from a Range or a Map<VecIterator>, one needs to write something like: fn foo<E: Extendable<int, Range<int>> + Extendable<int, Map<&'self int, int, VecIterator<int>>> (e: &mut E, ...) { ... } since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>` means that `foo` takes 2 type parameters, and the caller has to specify them (which doesn't work anyway, as they'll mismatch with the iterators used in `foo` itself). This patch changes it to: fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }
2013-08-14auto merge of #8439 : huonw/rust/hashset-clone, r=cmrbors-0/+26
Closes #5581.
2013-08-10std: Iterator.chain_ -> .chainErick Tryzelaar-2/+2
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-2/+2
cc #5898
2013-08-10std: merge Iterator and IteratorUtilErick Tryzelaar-1/+1
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-20/+20
cc #7887
2013-08-10std: add a Clone impl for HashSet.Huon Wilson-0/+26
2013-08-07std: Fix for-range loops that can use iteratorsblake2-ppc-3/+3
Fix inappropriate for-range loops to use for-iterator constructs (or other appropriate solution) instead.
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-2/+2
2013-08-06std: Rewrite the HashSet set operation iteratorsblake2-ppc-37/+17
Use the Repeat iterator to carry the "explicit closure capture" that was previously done with the custom EnvFilterIterator.
2013-08-03auto merge of #8264 : thestinger/rust/snapshot, r=Aatchbors-20/+20
2013-08-03remove obsolete `foreach` keywordDaniel Micay-20/+20
this has been replaced by `for`
2013-08-03auto merge of #8246 : stepancheg/rust/contains-key, r=thestingerbors-8/+0
Map::contains_key can be implemented with Map::find. Remove several implementations of contains_key.
2013-08-03std: expose the keyed HashMap constructor, for runtime-less use.Huon Wilson-28/+26
The `new` constructor uses the task-local RNG to retrieve seeds for the two key values, which requires the runtime. Exposing a constructor that takes the keys directly allows HashMaps to be used in programs that wish to avoid the runtime.
2013-08-03Add default implementation of Map::contains_key functionStepan Koltsov-8/+0
Map::contains_key can be implemented with Map::find. Remove several implementations of contains_key.
2013-08-02replace `range` with an external iteratorDaniel Micay-8/+5
2013-08-01std: Remove the internal iterator methods from trait Setblake2-ppc-22/+0
.intersection(), .union() etc methods in trait std::container::Set use internal iters. Remove these methods from the trait. I reported issue #8154 for the reinstatement of iterator-based set algebra methods to the Set trait. For bitv and treemap, that lack Iterator implementations of set operations, preserve them as methods directly on the types themselves. For HashSet, these methods are replaced by the present .union_iter() etc.
2013-08-01std: Replace `for` with `do { .. }` expr where internal iterators are usedblake2-ppc-19/+16
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-17/+18
2013-07-30std: Implement Extendable for hashmap, str and trieblake2-ppc-9/+17
2013-07-29std: Rename Iterator adaptor types to drop the -Iterator suffixblake2-ppc-3/+3
Drop the "Iterator" suffix for the the structs in std::iterator. Filter, Zip, Chain etc. are shorter type names for when iterator pipelines need their types written out in full in return value types, so it's easier to read and write. the iterator module already forms enough namespace.
2013-07-28Refactored vec and str iterators to remove prefixesjmgrosen-2/+2
2013-07-27auto merge of #8074 : thestinger/rust/iterator, r=cmrbors-2/+2
d7c9bb4 r=alexcrichton 7ae17e0 r=huonw
2013-07-27Remove dummy type parameters from iterator adaptorsblake2-ppc-2/+2
With the recent fixes to method resolution, we can now remove the dummy type parameters used as crutches in the iterator module. For example, the zip adaptor type is just ZipIterator<T, U> now.
2013-07-25Added default impls for container methodsSteven Fackler-19/+0
A couple of implementations of Container::is_empty weren't exactly self.len() == 0 so I left them alone (e.g. Treemap).
2013-07-21Minor cleanup of hashmapSteven Stewart-Gallus-11/+5
2013-07-20std: Implement Clone for VecIterator and iterators using itblake2-ppc-0/+2
The theory is simple, the immutable iterators simply hold state variables (indicies or pointers) into frozen containers. We can freely clone these iterators, just like we can clone borrowed pointers. VecIterator needs a manual impl to handle the lifetime struct member.
2013-07-20Use Option .take() or .take_unwrap() instead of util::replace where possibleblake2-ppc-2/+2
2013-07-18auto merge of #7857 : blake2-ppc/rust/fix-test-warnings, r=alexcrichtonbors-2/+2
Fix warnings that only show up when compiling the tests for libstd, libextra and one in librusti. Only trivial changes.
2013-07-18hashmap: Remove .consume() has rename .consume_iter() to .consume()blake2-ppc-64/+20
Updated all users of HashMap, HashSet old .consume() to use .consume() with a for loop. Since .consume() takes the map or set by value, it needs awkward extra code to in librusti's use of @mut HashMap, where the map value can not be directly moved out.
2013-07-18Fix warnings in libstd and librusti testsblake2-ppc-2/+2
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-6/+15
2013-07-16hashmap: Iterators for hashset diff, sym. diff, intersec, unionblake2-ppc-10/+70
Implement the difference, union, etc iterators with the help of a custom iterator combinator with explicit closure environment. Reported issue #7814 to be able to use the std::iterator filter combinator.
2013-07-16hashmap: Remove .mutate_values() which is replaced by .mut_iter()blake2-ppc-13/+0
2013-07-15std: add consuming iterators for `HashMap` and `HashSet`Andrew Paseltiner-0/+82
2013-07-14auto merge of #7788 : MarkJr94/rust/from_iter, r=cmrbors-1/+49
Added Iterators for HashMap/Set, TreeMap/Set, TrieMap/Set, and PriorityQueue as per Issue #7626
2013-07-14Stripped trailing spaces; Implemented FromIterator for TreeMap and PriorityQueue=Mark Sinclair-4/+4
2013-07-14Implemented FromIterator for TrieMap and TrieSet=Mark Sinclair-0/+25
2013-07-14Implemented FromIterator for std::hashmap=Mark Sinclair-1/+24
2013-07-13Split mutable methods out of Set and MapSteven Fackler-9/+13
Fixes most of #4989. I didn't add Persistent{Set,Map} since the only persistent data structure is fun_treemap and its functionality is currently too limited to build a trait out of.
2013-07-08 Replaces the free-standing functions in f32, &c.Jens Nockert-1/+2
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, float, int, and uint are replaced with generic functions in num instead. If you were previously using any of those functions, just replace them with the corresponding function with the same name in num. Note: If you were using a function that corresponds to an operator, use the operator instead.
2013-07-04Implement consuming iterators for ~[], remove vec::{consume, ↵Huon Wilson-3/+4
consume_reverse, map_consume}.
2013-06-30Convert vec::{rposition, rposition_elem, position_elem, contains} to methods.Huon Wilson-5/+5
2013-06-29Removing a lot of usage of '&const'Alex Crichton-4/+4
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-2/+3
for making them noncopyable.
2013-06-25remove `each` from vec, HashMap and HashSetDaniel Micay-11/+0
2013-06-25container: remove internal iterators from MapDaniel Micay-28/+28
the maps are being migrated to external iterators
2013-06-23hashmap: add FIXME numberDaniel Micay-1/+1
2013-06-23std::hashmap: Remove BaseIter impl for HashSetblake2-ppc-7/+6
Remove the BaseIter impl, while keeping the .each method until callers are converted.
2013-06-23std::hashmap: Use .iter() instead of .each and similarblake2-ppc-8/+7