about summary refs log tree commit diff
path: root/src/libcollections/bitv.rs
AgeCommit message (Collapse)AuthorLines
2014-11-02refactor libcollections as part of collection reformAlexis Beingessner-2761/+0
* Moves multi-collection files into their own directory, and splits them into seperate files * Changes exports so that each collection has its own module * Adds underscores to public modules and filenames to match standard naming conventions (that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet) * Renames PriorityQueue to BinaryHeap * Renames SmallIntMap to VecMap * Miscellanious fallout fixes [breaking-change]
2014-11-01collections: Remove all collections traitsAlex Crichton-52/+62
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-10/+11
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-16Removes useless confs from bitv.rsgamazeps-3/+0
Linked to #18009
2014-10-14auto merge of #18018 : gamazeps/rust/isuue16736, r=cmrbors-104/+105
Closes #16736 linked to #18009
2014-10-14Switches from uint to u32 in BitV and BitVSetFelix Raimundo-104/+105
Closes #16736 linked to #18009
2014-10-13rollup merge of #17970 : nodakai/cleanup-warningsAlex Crichton-1/+1
2014-10-13rollup merge of #17888 : gmfawcett/patch-1Alex Crichton-1/+1
2014-10-13Clean up rustc warnings.NODA, Kai-1/+1
compiletest: compact "linux" "macos" etc.as "unix". liballoc: remove a superfluous "use". libcollections: remove invocations of deprecated methods in favor of their suggested replacements and use "_" for a loop counter. libcoretest: remove invocations of deprecated methods; also add "allow(deprecated)" for testing a deprecated method itself. libglob: use "cfg_attr". libgraphviz: add a test for one of data constructors. libgreen: remove a superfluous "use". libnum: "allow(type_overflow)" for type cast into u8 in a test code. librustc: names of static variables should be in upper case. libserialize: v[i] instead of get(). libstd/ascii: to_lowercase() instead of to_lower(). libstd/bitflags: modify AnotherSetOfFlags to use i8 as its backend. It will serve better for testing various aspects of bitflags!. libstd/collections: "allow(deprecated)" for testing a deprecated method itself. libstd/io: remove invocations of deprecated methods and superfluous "use". Also add #[test] where it was missing. libstd/num: introduce a helper function to effectively remove invocations of a deprecated method. libstd/path and rand: remove invocations of deprecated methods and superfluous "use". libstd/task and libsync/comm: "allow(deprecated)" for testing a deprecated method itself. libsync/deque: remove superfluous "unsafe". libsync/mutex and once: names of static variables should be in upper case. libterm: introduce a helper function to effectively remove invocations of a deprecated method. We still see a few warnings about using obsoleted native::task::spawn() in the test modules for libsync. I'm not sure how I should replace them with std::task::TaksBuilder and native::task::NativeTaskBuilder (dependency to libstd?) Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-10-09In sieve example, end iteration soonerGraham Fawcett-1/+1
The Sieve algorithm only requires checking all elements up to and including the square root of the maximum prime you're looking for. After that, the remaining elements are guaranteed to be prime.
2014-10-08Clean up the implementations of Bitv and BitvSet.Kasey Carrothers-57/+131
Functions that add bits now ensure that any unused bits are set to 0. `into_bitv` sanitizes the nbits of the Bitv/BitvSet it returns by setting the nbits to the current capacity. Fix a bug with `union_with` and `symmetric_difference` with due to not updating nbits properly Add test cases to the _with functions Remove `get_mut_ref` This is a [breaking-change]. The things you will need to fix are: 1. BitvSet's `unwrap()` has been renamed to `into_bitv` 2. BitvSet's `get_mut_ref()` has been removed. Use `into_bitv()` and `from_bitv()` instead.
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-1/+1
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-1/+1
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-1/+1
2014-09-21Fix fallout from Vec stabilizationAlex Crichton-2/+2
2014-09-16Fallout from renamingAaron Turon-5/+5
2014-09-03bitv: add larger tests, better benchmarks & remove dead code.Huon Wilson-22/+29
There were no tests for iteration etc. with more than 5 elements, i.e. not even going beyond a single word. This situation is rectified. Also, the only benchmarks for `set` were with a constant bit value, which was not indicative of every situation, due to inlining & branch removal. This adds a benchmark at the other end of the spectrum: random input.
2014-08-26Use temp vars for implicit coercion to ^[T]Nick Cameron-1/+1
2014-08-21bitv: make sure benchmarks run long enoughVinzent Steinberg-7/+19
Previously they were too short (less than 10 ns), so the benchmarker could not resolve them meaningfully. Now they should run in the order of 100 ns.
2014-08-21bitv: make benchmarks always return a valueVinzent Steinberg-8/+11
This makes sure that the benchmarked code does not get optimized away. Also fixed a typo. Fixes #12118.
2014-08-19auto merge of #16241 : P1start/rust/doc-fixes, r=alexcrichtonbors-50/+55
For crates `alloc`–`collections`. This is mostly just updating a few function/method descriptions to use the indicative style. cc #4361; I’ve sort of assumed that the third-person indicative style has been decided on, but I could update this to use the imperative style if that’s preferred, or even update this to remove all function-style-related changes. (I think that standardising on one thing, even if it’s not the ‘best’ option, is still better than having no standard at all.) The indicative style seems to be more common in the Rust standard library at the moment, especially in the newer modules (e.g. `collections::vec`), more popular in the discussion about it, and also more popular amongst other languages (see https://github.com/rust-lang/rust/issues/4361#issuecomment-33470215).
2014-08-19auto merge of #16582 : Gankro/rust/bitv, r=alexcrichtonbors-26/+41
This was bothering me (and some other people). The macro was necessary in a transient step of my development, but I converged on a design where it was unnecessary, but it didn't really click that that had happened. This fixes it up.
2014-08-19A few minor documentation fixesP1start-50/+55
2014-08-18Fixing bitvset is_disjoint, fixes #16587Alexis Beingessner-1/+19
2014-08-18Refactor BitV internals to not use macro, reduce duplicationAlexis Beingessner-25/+22
2014-08-18auto merge of #16559 : Gankro/rust/bitv, r=pcwaltonbors-3/+114
These were the only differing-size-based errors I noticed. Might be more.
2014-08-17Correct internal BitvSet 0-padding, fixes #16542Alexis Beingessner-3/+114
2014-08-17auto merge of #16550 : kaseyc/rust/fix_documentation_error, r=alexcrichtonbors-1/+1
2014-08-16Fix an error in a code sample in bitv.rsKasey Carrothers-1/+1
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-2/+1
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-12Deprecation fallout in libcollectionsAaron Turon-7/+7
2014-08-02auto merge of #16180 : jbcrail/rust/fix-comments, r=steveklabnikbors-1/+1
2014-08-01Fix misspelled comments.Joseph Crail-1/+1
2014-08-01collections: Implement FromIterator/Extendable for BitvSetnham-1/+27
2014-07-28Implement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSetnham-1/+8
2014-07-28Implement PartialOrd for Bitv and BitvSetnham-1/+40
2014-07-23Remove kludgy imports from vec! macroBrian Anderson-1/+1
2014-07-23collections: Move push/pop to MutableSeqBrian Anderson-1/+1
Implement for Vec, DList, RingBuf. Add MutableSeq to the prelude. Since the collections traits are in the prelude most consumers of these methods will continue to work without change. [breaking-change]
2014-07-21Simplify and cleanup bitv examples.Jonas Hietala-74/+120
2014-07-21Describe BitPositions and TwoBitPositions.Jonas Hietala-0/+2
2014-07-21Polish bitv docs.Jonas Hietala-39/+44
2014-07-21Main bitv example: prime sieve.Jonas Hietala-0/+49
2014-07-21Move intersection above difference and symmetric_differance.Jonas Hietala-29/+29
So all comes in the order union, intersection, difference and symmetric_difference.
2014-07-21Document BitvSet.Jonas Hietala-19/+297
2014-07-21Document Bitv.Jonas Hietala-94/+307
2014-07-21Group union, intersect and difference in Bitv.Jonas Hietala-22/+22
2014-07-21Place union as the first function, for consistency.Jonas Hietala-12/+12
2014-07-21Move in-place functions below their iterator variants.Jonas Hietala-24/+24
2014-07-10auto merge of #15556 : alexcrichton/rust/snapshots, r=brsonbors-6/+1
Closes #15544
2014-07-09libcollections: Use iterators instead of old-style loops.Luqman Aden-34/+10