mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 23:13:15 +00:00
provide a SpecExtend
trait for Vec<T>
The discussion is [here](https://internals.rust-lang.org/t/append-vec-to-binaryheap/15209/3)
This commit is contained in:
parent
b3074819f6
commit
2feee3659e
@ -1584,6 +1584,14 @@ impl<T: Ord, I: IntoIterator<Item = T>> SpecExtend<I> for BinaryHeap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Ord> SpecExtend<Vec<T>> for BinaryHeap<T> {
|
||||
fn spec_extend(&mut self, ref mut other: Vec<T>) {
|
||||
let start = self.data.len();
|
||||
self.data.append(other);
|
||||
self.rebuild_tail(start);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Ord> SpecExtend<BinaryHeap<T>> for BinaryHeap<T> {
|
||||
fn spec_extend(&mut self, ref mut other: BinaryHeap<T>) {
|
||||
self.append(other);
|
||||
|
Loading…
Reference in New Issue
Block a user