@@ -161,14 +161,14 @@ use vec::{mod, Vec};
161161///
162162/// This will be a max-heap.
163163#[ deriving( Clone ) ]
164+ #[ stable]
164165pub struct BinaryHeap < T > {
165166 data : Vec < T > ,
166167}
167168
168169#[ stable]
169170impl < T : Ord > Default for BinaryHeap < T > {
170171 #[ inline]
171- #[ stable]
172172 fn default ( ) -> BinaryHeap < T > { BinaryHeap :: new ( ) }
173173}
174174
@@ -182,7 +182,7 @@ impl<T: Ord> BinaryHeap<T> {
182182 /// let mut heap = BinaryHeap::new();
183183 /// heap.push(4u);
184184 /// ```
185- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
185+ #[ stable ]
186186 pub fn new ( ) -> BinaryHeap < T > { BinaryHeap { data : vec ! [ ] } }
187187
188188 /// Creates an empty `BinaryHeap` with a specific capacity.
@@ -197,7 +197,7 @@ impl<T: Ord> BinaryHeap<T> {
197197 /// let mut heap = BinaryHeap::with_capacity(10);
198198 /// heap.push(4u);
199199 /// ```
200- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
200+ #[ stable ]
201201 pub fn with_capacity ( capacity : uint ) -> BinaryHeap < T > {
202202 BinaryHeap { data : Vec :: with_capacity ( capacity) }
203203 }
@@ -235,7 +235,7 @@ impl<T: Ord> BinaryHeap<T> {
235235 /// println!("{}", x);
236236 /// }
237237 /// ```
238- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
238+ #[ stable ]
239239 pub fn iter ( & self ) -> Iter < T > {
240240 Iter { iter : self . data . iter ( ) }
241241 }
@@ -256,7 +256,7 @@ impl<T: Ord> BinaryHeap<T> {
256256 /// println!("{}", x);
257257 /// }
258258 /// ```
259- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
259+ #[ stable ]
260260 pub fn into_iter ( self ) -> IntoIter < T > {
261261 IntoIter { iter : self . data . into_iter ( ) }
262262 }
@@ -291,7 +291,7 @@ impl<T: Ord> BinaryHeap<T> {
291291 /// assert!(heap.capacity() >= 100);
292292 /// heap.push(4u);
293293 /// ```
294- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
294+ #[ stable ]
295295 pub fn capacity ( & self ) -> uint { self . data . capacity ( ) }
296296
297297 /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
@@ -314,7 +314,7 @@ impl<T: Ord> BinaryHeap<T> {
314314 /// assert!(heap.capacity() >= 100);
315315 /// heap.push(4u);
316316 /// ```
317- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
317+ #[ stable ]
318318 pub fn reserve_exact ( & mut self , additional : uint ) {
319319 self . data . reserve_exact ( additional) ;
320320 }
@@ -335,13 +335,13 @@ impl<T: Ord> BinaryHeap<T> {
335335 /// assert!(heap.capacity() >= 100);
336336 /// heap.push(4u);
337337 /// ```
338- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
338+ #[ stable ]
339339 pub fn reserve ( & mut self , additional : uint ) {
340340 self . data . reserve ( additional) ;
341341 }
342342
343343 /// Discards as much additional capacity as possible.
344- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
344+ #[ stable ]
345345 pub fn shrink_to_fit ( & mut self ) {
346346 self . data . shrink_to_fit ( ) ;
347347 }
@@ -359,7 +359,7 @@ impl<T: Ord> BinaryHeap<T> {
359359 /// assert_eq!(heap.pop(), Some(1));
360360 /// assert_eq!(heap.pop(), None);
361361 /// ```
362- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
362+ #[ stable ]
363363 pub fn pop ( & mut self ) -> Option < T > {
364364 self . data . pop ( ) . map ( |mut item| {
365365 if !self . is_empty ( ) {
@@ -384,7 +384,7 @@ impl<T: Ord> BinaryHeap<T> {
384384 /// assert_eq!(heap.len(), 3);
385385 /// assert_eq!(heap.peek(), Some(&5));
386386 /// ```
387- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
387+ #[ stable ]
388388 pub fn push ( & mut self , item : T ) {
389389 let old_len = self . len ( ) ;
390390 self . data . push ( item) ;
@@ -539,11 +539,11 @@ impl<T: Ord> BinaryHeap<T> {
539539 }
540540
541541 /// Returns the length of the binary heap.
542- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
542+ #[ stable ]
543543 pub fn len ( & self ) -> uint { self . data . len ( ) }
544544
545545 /// Checks if the binary heap is empty.
546- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
546+ #[ stable ]
547547 pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
548548
549549 /// Clears the binary heap, returning an iterator over the removed elements.
@@ -554,7 +554,7 @@ impl<T: Ord> BinaryHeap<T> {
554554 }
555555
556556 /// Drops all items from the binary heap.
557- #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
557+ #[ stable ]
558558 pub fn clear ( & mut self ) { self . drain ( ) ; }
559559}
560560
@@ -570,6 +570,7 @@ impl<'a, T> Clone for Iter<'a, T> {
570570 }
571571}
572572
573+ #[ stable]
573574impl < ' a , T > Iterator < & ' a T > for Iter < ' a , T > {
574575 #[ inline]
575576 fn next ( & mut self ) -> Option < & ' a T > { self . iter . next ( ) }
@@ -578,18 +579,21 @@ impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
578579 fn size_hint ( & self ) -> ( uint , Option < uint > ) { self . iter . size_hint ( ) }
579580}
580581
582+ #[ stable]
581583impl < ' a , T > DoubleEndedIterator < & ' a T > for Iter < ' a , T > {
582584 #[ inline]
583585 fn next_back ( & mut self ) -> Option < & ' a T > { self . iter . next_back ( ) }
584586}
585587
588+ #[ stable]
586589impl < ' a , T > ExactSizeIterator < & ' a T > for Iter < ' a , T > { }
587590
588591/// An iterator that moves out of a `BinaryHeap`.
589592pub struct IntoIter < T > {
590593 iter : vec:: IntoIter < T > ,
591594}
592595
596+ #[ stable]
593597impl < T > Iterator < T > for IntoIter < T > {
594598 #[ inline]
595599 fn next ( & mut self ) -> Option < T > { self . iter . next ( ) }
@@ -598,18 +602,21 @@ impl<T> Iterator<T> for IntoIter<T> {
598602 fn size_hint ( & self ) -> ( uint , Option < uint > ) { self . iter . size_hint ( ) }
599603}
600604
605+ #[ stable]
601606impl < T > DoubleEndedIterator < T > for IntoIter < T > {
602607 #[ inline]
603608 fn next_back ( & mut self ) -> Option < T > { self . iter . next_back ( ) }
604609}
605610
611+ #[ stable]
606612impl < T > ExactSizeIterator < T > for IntoIter < T > { }
607613
608614/// An iterator that drains a `BinaryHeap`.
609615pub struct Drain < ' a , T : ' a > {
610616 iter : vec:: Drain < ' a , T > ,
611617}
612618
619+ #[ stable]
613620impl < ' a , T : ' a > Iterator < T > for Drain < ' a , T > {
614621 #[ inline]
615622 fn next ( & mut self ) -> Option < T > { self . iter . next ( ) }
@@ -618,19 +625,23 @@ impl<'a, T: 'a> Iterator<T> for Drain<'a, T> {
618625 fn size_hint ( & self ) -> ( uint , Option < uint > ) { self . iter . size_hint ( ) }
619626}
620627
628+ #[ stable]
621629impl < ' a , T : ' a > DoubleEndedIterator < T > for Drain < ' a , T > {
622630 #[ inline]
623631 fn next_back ( & mut self ) -> Option < T > { self . iter . next_back ( ) }
624632}
625633
634+ #[ stable]
626635impl < ' a , T : ' a > ExactSizeIterator < T > for Drain < ' a , T > { }
627636
637+ #[ stable]
628638impl < T : Ord > FromIterator < T > for BinaryHeap < T > {
629639 fn from_iter < Iter : Iterator < T > > ( iter : Iter ) -> BinaryHeap < T > {
630640 BinaryHeap :: from_vec ( iter. collect ( ) )
631641 }
632642}
633643
644+ #[ stable]
634645impl < T : Ord > Extend < T > for BinaryHeap < T > {
635646 fn extend < Iter : Iterator < T > > ( & mut self , mut iter : Iter ) {
636647 let ( lower, _) = iter. size_hint ( ) ;
0 commit comments