Skip to content

Commit d903231

Browse files
committed
add a BaseIter implementation for PriorityQueue
1 parent 6647a34 commit d903231

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libstd/priority_queue.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use core::container::{Container, Mutable};
1414
use core::cmp::Ord;
15+
use core::iter::BaseIter;
1516
use core::prelude::*;
1617
use core::ptr::addr_of;
1718
use core::vec;
@@ -26,6 +27,14 @@ pub struct PriorityQueue<T> {
2627
priv data: ~[T],
2728
}
2829

30+
impl <T: Ord> PriorityQueue<T>: BaseIter<T> {
31+
/// Visit all values in the underlying vector.
32+
///
33+
/// The values are **not** visited in order.
34+
pure fn each(&self, f: fn(&T) -> bool) { self.data.each(f) }
35+
pure fn size_hint(&self) -> Option<uint> { self.data.size_hint() }
36+
}
37+
2938
impl <T: Ord> PriorityQueue<T>: Container {
3039
/// Returns the length of the queue
3140
pure fn len(&self) -> uint { self.data.len() }

0 commit comments

Comments
 (0)