summary refs log tree commit diff
path: root/src/libcollections/binary_heap.rs
AgeCommit message (Collapse)AuthorLines
2015-01-05Revert "Remove i suffix in docs"Alex Crichton-11/+11
This reverts commit f031671c6ea79391eeb3e1ad8f06fe0e436103fb. Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05rollup merge of #20560: aturon/stab-2-iter-ops-sliceAlex Crichton-0/+5
Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05Remove i suffix in docsSteve Klabnik-11/+11
2015-01-05Stabilization of impls and fallout from stabilizationAaron Turon-0/+4
2015-01-05Stabilize collection modulesAaron Turon-0/+1
The earlier collections stabilization did not cover the modules themselves. This commit marks as stable those modules whose types have been stabilized.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-3/+3
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2015-01-03collections: fix falloutJorge Aparicio-11/+17
2015-01-02std: Stabilize the prelude moduleAlex Crichton-0/+2
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-12-31stabilize more of collectionsAlexis Beingessner-14/+25
2014-12-30rollup merge of #20061: aturon/stab-2-vec-sliceAlex Crichton-1/+1
Conflicts: src/libcollections/slice.rs src/libcollections/vec.rs src/libstd/sys/windows/os.rs
2014-12-30Fallout from stabilizationAaron Turon-1/+1
2014-12-30Implement `Clone` for a large number of iterators & other adaptors.Huon Wilson-0/+7
It's useful to be able to save state.
2014-12-24clean up `BinaryHeap` codeAndrew Paseltiner-107/+94
2014-12-22rollup merge of #20056: MrFloya/iter_renameAlex Crichton-14/+14
Conflicts: src/libcollections/bit.rs src/libcore/str.rs
2014-12-22Added missing renames:Florian Wilkens-1/+2
libcollections: AbsEntries -> AbsIter, Entries -> Iter, MoveEntries -> IntoIter, MutEntries -> IterMut DifferenceItems -> Difference, SymDifferenceItems -> SymmetricDifference, IntersectionItems -> Intersection, UnionItems -> Union libstd/hash/{table, map}: Entries -> Iter, MoveItems -> IntoIter, MutEntries -> IterMut Also a [breaking-change].
2014-12-22Renaming of the Iter types as in RFC #344Florian Wilkens-15/+14
libcore: slice::Items -> slice::Iter, slice::MutItems -> slice::IterMut libcollections: *::Items -> *::Iter, *::MoveItems -> *::IntoIter, *::MutItems -> *::IterMut This is of course a [breaking-change].
2014-12-21Misc Stabilization for collectionsChase Southwood-22/+23
This commit: *Renames `BinaryHeap::top` to `BinaryHeap::peek` *Stabilizes `front/back/front_mut/back_mut` in `DList` and `RingBuf` *Stabilizes `swap` in `RingBuf` Because of the method renaming, this is a [breaking-change].
2014-12-21rollup merge of #19967: apasel422/binary_heapAlex Crichton-24/+28
Just a few simplifications and a missing `assert!`.
2014-12-21auto merge of #19946 : cgaebel/rust/hashmap-drain-iter, r=gankrobors-1/+40
It is useful to move all the elements out of a hashmap without deallocating the underlying buffer. It came up in IRC, and this patch implements it as `drain`. r? @Gankro cc: @frankmcsherry
2014-12-20Fix fallout of removing import_shadowing in tests.Eduard Burtescu-2/+1
2014-12-19libcollections: use `#[deriving(Copy)]`Jorge Aparicio-3/+1
2014-12-18[collections] Adds `drain`: a way to sneak out the elements while clearing.Clark Gaebel-1/+40
It is useful to move all the elements out of some collections without deallocating the underlying buffer. It came up in IRC, and this patch implements it as `drain`. This has been discussed as part of RFC 509. r? @Gankro cc: @frankmcsherry
2014-12-18Clean up `collections::binary_heap`Andrew Paseltiner-24/+28
2014-12-15std: Second pass stabilization of `default`Alex Crichton-0/+2
This commit performs a second pass stabilization of the `std::default` module. The module was already marked `#[stable]`, and the inheritance of `#[stable]` was removed since this attribute was applied. This commit adds the `#[stable]` attribute to the trait definition and one method name, along with all implementations found in the standard distribution.
2014-12-10auto merge of #19655 : jbranchaud/rust/change-example-to-examples, ↵bors-16/+16
r=steveklabnik @steveklabnik I got a start on this.
2014-12-08Change 'Example' to 'Examples' throughout collections' rustdocs.jbranchaud-16/+16
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+2
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-06libcollections: remove unnecessary `as_mut_slice()` callsJorge Aparicio-1/+1
2014-12-06libcollections: remove unnecessary `as_slice()` callsJorge Aparicio-3/+3
2014-12-01Pop on binary heaps does not have constant time complexity.Jim Apple-2/+2
pop calls siftdown, siftdown calls siftdown_range, and siftdown_range loops on an index that can start as low as 0 and approximately doubles each iteration.
2014-11-26More test fixes and rebase conflicts!Alex Crichton-1/+1
2014-11-26rollup merge of #19330: csouth3/binaryheap-iterAlex Crichton-0/+17
There's no reason that BinaryHeap's iterator can't implement DoubleEnded and ExactSize, so add these implementations.
2014-11-25Make BinaryHeap's Items iterator implement DoubleEnded and ExactSizeChase Southwood-0/+17
2014-11-25Fallout from stabilizationAaron Turon-2/+2
2014-11-24auto merge of #19236 : csouth3/rust/master, r=Gankrobors-3/+79
Whilst browsing the source for BinaryHeap, I saw a FIXME for implementing into_iter. I think, since the BinaryHeap is represented internally using just a Vec, just calling into_iter() on the BinaryHeap's data should be sufficient to do what we want here. If this actually isn't the right approach (e.g., I should write a struct MoveItems and appropriate implementation for BinaryHeap instead), let me know and I'll happily rework this. Both of the tests that I have added pass. This is my first contribution to Rust, so please let me know any ways I can improve this PR!
2014-11-23Implement into_iter() for BinaryHeap.Chase Southwood-3/+79
2014-11-21Rename variables called pq to heapMatt McPherrin-53/+53
The old name was sensible when this module was PriorityQueue but isn't anymore.
2014-11-08Renamed Extendable to Extendgamazeps-1/+1
In order to upgrade, simply rename the Extendable trait to Extend in your code Part of #18424 [breaking-change]
2014-11-06Implement low-hanging fruit of collection conventionsAlexis Beingessner-10/+40
* Renames/deprecates the simplest and most obvious methods * Adds FIXME(conventions)s for outstanding work * Marks "handled" methods as unstable NOTE: the semantics of reserve and reserve_exact have changed! Other methods have had their semantics changed as well, but in a way that should obviously not typecheck if used incorrectly. Lots of work and breakage to come, but this handles most of the core APIs and most eggregious breakage. Future changes should *mostly* focus on niche collections, APIs, or simply back-compat additions. [breaking-change]
2014-11-02refactor libcollections as part of collection reformAlexis Beingessner-0/+698
* 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]