(&mut self, v: T)
| 17 | } |
| 18 | |
| 19 | pub fn insert(&mut self, v: T) { |
| 20 | self.pq.enqueue(v); |
| 21 | // remove minimum if m+1 entries on the PQ |
| 22 | if self.pq.len() > self.m { |
| 23 | let _ = self.pq.dequeue(); |
| 24 | } |
| 25 | // top m entries are on the PQ |
| 26 | } |
| 27 | |
| 28 | pub fn into_vec(mut self) -> Vec<T> { |
| 29 | let mut vec = Vec::with_capacity(self.m); |