about summary refs log tree commit diff
path: root/src/libstd/hashmap.rs
AgeCommit message (Collapse)AuthorLines
2014-02-20Mass rename if_ok! to try!Alex Crichton-6/+6
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-14Register new snapshotsAlex Crichton-4/+2
This enables the parser error for `extern mod` => `extern crate` transitions.
2014-02-13Removed num::OrderableMichael Darakananda-2/+2
2014-02-13Add some missing Show implementations in libstdBrendan Zabarauskas-0/+75
2014-02-11Move replace and swap to std::mem. Get rid of std::utilEdward Wang-1/+1
Also move Void to std::any, move drop to std::mem and reexport in prelude.
2014-02-04Rename reserve to reserve_exact and reserve_at_least to reserveDavid Manescu-3/+3
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}. Fixes #11949
2014-02-01Remove some unused importsBrendan Zabarauskas-1/+0
2014-02-01Make next_power_of_two generic for unsigned integersBrendan Zabarauskas-1/+1
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-01-22hashmap: port to Vec<T>Daniel Micay-25/+25
2014-01-18Rename iterators for consistencyPalmer Cox-37/+37
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2013-12-31Fix issue #11216 - Replace std::hashmap::{each_key, each_value} with iterators.Gareth Smith-6/+39
2013-12-29auto merge of #11134 : lucab/rust/lucab/libstd-doc, r=cmrbors-1/+1
Uniform the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index.
2013-12-29std::hashmap: add an example with the basic methods.Huon Wilson-0/+39
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-27std::hashmap: add an example to mangle.Huon Wilson-0/+37
2013-12-16vec: make the move iterator fast for all typesDaniel Micay-8/+5
Closes #10976
2013-12-11Make 'self lifetime illegal.Erik Price-15/+15
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-11-28Register new snapshotsAlex Crichton-1/+1
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-9/+7
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-10/+10
2013-11-25rm #[mutable_doc]Daniel Micay-2/+0
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-9/+18
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-8/+8
Who doesn't like a massive renaming?
2013-10-09option: rewrite the API to use compositionDaniel Micay-2/+2
2013-09-30std: Remove usage of fmt!Alex Crichton-8/+8
2013-09-23std: merge rand::{Rng,RngUtil} with default methods.Huon Wilson-1/+1
Also, documentation & general clean-up: - remove `gen_char_from`: better served by `sample` or `choose`. - `gen_bytes` generalised to `gen_vec`. - `gen_int_range`/`gen_uint_range` merged into `gen_integer_range` and made to be properly uniformly distributed. Fixes #8644. Minor adjustments to other functions.
2013-09-19Replace unreachable() calls with unreachable!().Chris Morgan-2/+2
This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
2013-09-14auto merge of #9115 : erickt/rust/master, r=ericktbors-0/+9
This is a series of patches to modernize option and result. The highlights are: * rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)` * add `.unwrap_or_default()` that uses the `Default` trait * add `Default` implementations for vecs, HashMap, Option * add `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>` * add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither` * renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`. * Added a bunch of impls of `Default` * Added a `#[deriving(Default)]` syntax extension * Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-12std: add default implementations to HashMapErick Tryzelaar-0/+9
2013-09-11Add HashSet::with_capacity_and_keys() functionFlorian Hahn-0/+11
This function can be use to create HashSets before the tls is initialized.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-2/+2
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-3/+3
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
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