clt_database/alloc/collections/
binary_heap.rs1use super::*;
2use crate::alloc::*;
3
4const fn binary_heap<T: Ord>() -> BinaryHeap<T> {
5 BinaryHeap::new()
6}
7
8impl<T: Ord> TursoAllocExt for BinaryHeap<T> {
9 #[inline(always)]
10 fn new() -> Self {
11 binary_heap()
12 }
13}
14
15impl<T: Ord> TursoBinaryHeapExt<T> for BinaryHeap<T> {
16 #[inline(always)]
17 fn try_push(&mut self, value: T) -> Result<(), TryReserveError> {
18 self.push(value);
19 Ok(())
20 }
21}
22
23impl<T: Ord> TursoTryWithCapacityExt for BinaryHeap<T> {
24 #[inline(always)]
25 fn try_with_capacity_ext(capacity: usize) -> Result<Self, TryReserveError> {
26 Ok(BinaryHeap::with_capacity(capacity))
27 }
28}
29
30impl<T: Ord> TursoFromIterator<T> for BinaryHeap<T> {
31 #[inline(always)]
32 fn try_from_iter<I>(iter: I) -> Result<Self, TryReserveError>
33 where
34 I: IntoIterator<Item = T>,
35 {
36 Ok(iter.into_iter().collect())
37 }
38
39 #[inline(always)]
40 fn try_extend<I>(&mut self, iter: I) -> Result<(), TryReserveError>
41 where
42 I: IntoIterator<Item = T>,
43 {
44 self.extend(iter);
45 Ok(())
46 }
47}