make priorityqueue's from_iter use heapify

This commit is contained in:
Alexis Beingessner 2014-08-21 19:42:35 -04:00
parent dc65307e3b
commit b8dc103a95

View File

@ -527,10 +527,9 @@ fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
impl<T: Ord> FromIterator<T> for PriorityQueue<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
let mut q = PriorityQueue::new();
q.extend(iter);
q
fn from_iter<Iter: Iterator<T>>(mut iter: Iter) -> PriorityQueue<T> {
let vec: Vec<T> = iter.collect();
PriorityQueue::from_vec(vec)
}
}