about summary refs log tree commit diff
path: root/src/libstd/collections/hashmap.rs
AgeCommit message (Collapse)AuthorLines
2014-09-02std: Split hashmap.rs into modulesPiotr Czarnecki-3452/+0
2014-09-02std: RawTable exposes a safe interface for HashMapPiotr Czarnecki-528/+883
Introduced a new growth algorithm.
2014-09-02std: branchless bucket distance for hashmapPiotr Czarnecki-9/+1
2014-08-29Register new snapshotsAlex Crichton-18/+0
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-2/+20
2014-08-13core: Rename ImmutableEqSlice to ImmutablePartialEqSliceBrian Anderson-1/+1
This is in the prelude and won't break much code. [breaking-change]
2014-08-13std: Rename various slice traits for consistencyBrian Anderson-1/+1
ImmutableVector -> ImmutableSlice ImmutableEqVector -> ImmutableEqSlice ImmutableOrdVector -> ImmutableOrdSlice MutableVector -> MutableSlice MutableVectorAllocating -> MutableSliceAllocating MutableCloneableVector -> MutableCloneableSlice MutableOrdVector -> MutableOrdSlice These are all in the prelude so most code will not break. [breaking-change]
2014-08-12auto merge of #16195 : P1start/rust/more-index, r=aturonbors-6/+48
Implement `Index` for `RingBuf`, `HashMap`, `TreeMap`, `SmallIntMap`, and `TrieMap`. If there’s anything that I missed or should be removed, let me know.
2014-08-12Implement Index for HashMapP1start-6/+48
This also deprecates HashMap::get. Use indexing instead.
2014-08-01Fix misspelled comments.Joseph Crail-1/+1
2014-07-28doc: reduce overlong sentenceTshepang Lekhonkhobe-1/+1
2014-07-27doc: Correctly onclose code blocks in HashSetJonas Hietala-0/+3
2014-07-24Cleanup HashMap documentation.Jonas Hietala-53/+68
Link to mentioned methods. Use `# Failure` tags to describe failure. Make `pop_equiv`, `find_equiv` and `get_copy` standalone.
2014-07-24Remove explicit rust code specifier. Unhide use HashMap.Jonas Hietala-56/+56
2014-07-24Fill in example code for HashMap.Jonas Hietala-19/+293
Add an example showing how to use the map with a custom type. Fill in examples for methods in the hashmap file without ones. Also move pop_equiv next to related public methods, to not create a duplicate trait implementation in the docs.
2014-07-23Just land alreadyBrian Anderson-1/+1
2014-07-22auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichtonbors-0/+2
2014-07-21Add a ton of ignore-lexer-testCorey Richardson-0/+2
2014-07-18Remove examples from trait implementations. Unhide imports.Jonas Hietala-154/+18
2014-07-18Fill in documentation for HashSet.Jonas Hietala-37/+267
Example how to use the set with a custom type. Fill in examples for the missing methods.
2014-07-16Extend HashSet documentation.Jonas Hietala-4/+159
Add main example and simple examples for the methods.
2014-07-04librustc: Remove the `&LIFETIME EXPR` production from the language.Patrick Walton-6/+3
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change]
2014-06-30std: micro optimize Hash{Map,Set}::{new,with_capacity}Erick Tryzelaar-0/+8
2014-06-30std: make sure HashMap from_iter uses random initialization by defaultErick Tryzelaar-15/+10
It turns out that HashMap's from_iter implementation was being initialized without the sip keys being randomized. This adds a custom default hasher that should avoid this potential vulnerability.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-2/+2
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-70/+70
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-15Register new snapshotsAlex Crichton-24/+0
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-0/+24
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-10auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichtonbors-3/+2
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code. The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-09core: Move the collections traits to libcollectionsAlex Crichton-3/+3
This commit moves Mutable, Map, MutableMap, Set, and MutableSet from `core::collections` to the `collections` crate at the top-level. Additionally, this removes the `deque` module and moves the `Deque` trait to only being available at the top-level of the collections crate. All functionality continues to be reexported through `std::collections`. [breaking-change]
2014-06-08core: Rename `container` mod to `collections`. Closes #12543Brian Anderson-2/+2
Also renames the `Container` trait to `Collection`. [breaking-change]
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-3/+2
2014-06-06Implement Eq for HashSet and HashMapSteven Fackler-3/+7
Also fix documentation references to PartialEq.
2014-06-05Fallout from the libcollections movementAlex Crichton-12/+22
2014-06-05std: Recreate a `collections` moduleAlex Crichton-0/+2507
As with the previous commit with `librand`, this commit shuffles around some `collections` code. The new state of the world is similar to that of librand: * The libcollections crate now only depends on libcore and liballoc. * The standard library has a new module, `std::collections`. All functionality of libcollections is reexported through this module. I would like to stress that this change is purely cosmetic. There are very few alterations to these primitives. There are a number of notable points about the new organization: * std::{str, slice, string, vec} all moved to libcollections. There is no reason that these primitives shouldn't be necessarily usable in a freestanding context that has allocation. These are all reexported in their usual places in the standard library. * The `hashmap`, and transitively the `lru_cache`, modules no longer reside in `libcollections`, but rather in libstd. The reason for this is because the `HashMap::new` contructor requires access to the OSRng for initially seeding the hash map. Beyond this requirement, there is no reason that the hashmap could not move to libcollections. I do, however, have a plan to move the hash map to the collections module. The `HashMap::new` function could be altered to require that the `H` hasher parameter ascribe to the `Default` trait, allowing the entire `hashmap` module to live in libcollections. The key idea would be that the default hasher would be different in libstd. Something along the lines of: // src/libstd/collections/mod.rs pub type HashMap<K, V, H = RandomizedSipHasher> = core_collections::HashMap<K, V, H>; This is not possible today because you cannot invoke static methods through type aliases. If we modified the compiler, however, to allow invocation of static methods through type aliases, then this type definition would essentially be switching the default hasher from `SipHasher` in libcollections to a libstd-defined `RandomizedSipHasher` type. This type's `Default` implementation would randomly seed the `SipHasher` instance, and otherwise perform the same as `SipHasher`. This future state doesn't seem incredibly far off, but until that time comes, the hashmap module will live in libstd to not compromise on functionality. * In preparation for the hashmap moving to libcollections, the `hash` module has moved from libstd to libcollections. A previously snapshotted commit enables a distinct `Writer` trait to live in the `hash` module which `Hash` implementations are now parameterized over. Due to using a custom trait, the `SipHasher` implementation has lost its specialized methods for writing integers. These can be re-added backwards-compatibly in the future via default methods if necessary, but the FNV hashing should satisfy much of the need for speedier hashing. A list of breaking changes: * HashMap::{get, get_mut} no longer fails with the key formatted into the error message with `{:?}`, instead, a generic message is printed. With backtraces, it should still be not-too-hard to track down errors. * The HashMap, HashSet, and LruCache types are now available through std::collections instead of the collections crate. * Manual implementations of hash should be parameterized over `hash::Writer` instead of just `Writer`. [breaking-change]