use alloc::collections::BinaryHeap;
use super::{Collection, CollectionBase, CollectionCapacity};
impl<T: Ord> CollectionBase for BinaryHeap<T> {
type Item = T;
fn item_count(&self) -> usize {
BinaryHeap::len(self)
}
fn push(&mut self, elem: Self::Item) {
BinaryHeap::push(self, elem)
}
fn clear(&mut self) {
BinaryHeap::clear(self)
}
}
impl<T: Ord> Collection for BinaryHeap<T> {
fn with_capacity(capacity: usize) -> Self {
BinaryHeap::with_capacity(capacity)
}
}
impl<T: Ord> CollectionCapacity for BinaryHeap<T> {
type ReserveError = alloc::collections::TryReserveError;
fn capacity(&self) -> usize {
BinaryHeap::capacity(self)
}
fn reserve(&mut self, additional: usize) {
BinaryHeap::reserve(self, additional)
}
fn try_reserve(&mut self, additional: usize) -> Result<(), Self::ReserveError> {
BinaryHeap::try_reserve(self, additional)
}
}