1pub(crate) mod array;
4pub use array::*;
5#[cfg(feature = "alloc")]
6pub(crate) mod vec;
7use core::fmt::Debug;
8
9#[cfg(feature = "alloc")]
10pub use vec::*;
11
12use crate::{
13 comparators::{ByOrd, tie_breaker},
14 internal::{PeekIter, StorageOps},
15 merge_iter::DefaultBuilder,
16};
17
18pub trait Storage: StorageOps + Sized {
20 #[inline]
22 fn into_builder(self) -> DefaultBuilder<Self> {
23 DefaultBuilder::new(self, ByOrd, tie_breaker::InsertionOrder)
24 }
25}
26
27impl<S: StorageOps + Sized> Storage for S {}
28
29struct DebugFormatter<'a, S>(&'a S);
30
31impl<S> Debug for DebugFormatter<'_, S>
32where
33 S: Storage,
34 PeekIter<S::IT>: Debug,
35{
36 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
37 let mut d = f.debug_list();
38 self.0.map_items(|it| {
39 d.entry(it);
40 });
41 d.finish()
42 }
43}
44
45#[inline]
50pub fn debug_formatter<S>(storage: &'_ S) -> impl Debug + '_
51where
52 S: Storage,
53 PeekIter<S::IT>: Debug,
54{
55 DebugFormatter(storage)
56}