diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-06-23 17:57:39 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-06-24 01:35:11 -0400 |
| commit | e2e39234cc5509fb461b8805eeb32c5ce538ee6e (patch) | |
| tree | 3d3e6047f22148cb76916b20c4ed274fc99a177d /src/libextra/priority_queue.rs | |
| parent | ac4211ef52a3577f901ed4dc7f370b05ca4e638d (diff) | |
| download | rust-e2e39234cc5509fb461b8805eeb32c5ce538ee6e.tar.gz rust-e2e39234cc5509fb461b8805eeb32c5ce538ee6e.zip | |
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
Diffstat (limited to 'src/libextra/priority_queue.rs')
| -rw-r--r-- | src/libextra/priority_queue.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index 31c9acbbd54..4e201a6538b 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -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] } |
