1
Fork 0

remove old_iter

the `test/run-pass/class-trait-bounded-param.rs` test was xfailed and
written in an ancient dialect of Rust so I've just removed it

this also removes `to_vec` from DList because it's provided by
`std::iter::to_vec`

an Iterator implementation is added for OptVec but some transitional
internal iterator methods are still left
This commit is contained in:
Daniel Micay 2013-06-23 17:57:39 -04:00
parent ac4211ef52
commit e2e39234cc
22 changed files with 122 additions and 551 deletions

View file

@ -14,25 +14,15 @@
use core::prelude::*;
use core::old_iter::BaseIter;
use core::unstable::intrinsics::{move_val_init, init};
use core::util::{replace, swap};
use core::vec;
#[allow(missing_doc)]
/// A priority queue implemented with a binary heap
pub struct PriorityQueue<T> {
priv data: ~[T],
}
impl<T:Ord> BaseIter<T> for PriorityQueue<T> {
/// Visit all values in the underlying vector.
///
/// The values are **not** visited in order.
fn each(&self, f: &fn(&T) -> bool) -> bool { self.data.iter().advance(f) }
fn size_hint(&self) -> Option<uint> { Some(self.data.len()) }
}
impl<T:Ord> Container for PriorityQueue<T> {
/// Returns the length of the queue
fn len(&self) -> uint { self.data.len() }
@ -47,6 +37,11 @@ impl<T:Ord> Mutable for PriorityQueue<T> {
}
impl<T:Ord> PriorityQueue<T> {
/// Visit all values in the underlying vector.
///
/// The values are **not** visited in order.
pub fn each(&self, f: &fn(&T) -> bool) -> bool { self.data.iter().advance(f) }
/// Returns the greatest item in the queue - fails if empty
pub fn top<'a>(&'a self) -> &'a T { &self.data[0] }