1mod pigeon {
2 pub(crate) use pigeon_core::*;
3 pub(crate) use pigeon_macs::*;
4}
5
6use core::fmt::Debug;
7use pigeon::*;
8use bumpalo::Bump;
9
10#[derive(PrependAstImpl)]
11pub struct BRVec<'b, T>(bumpalo::collections::Vec<'b, T>);
12
13impl<'b, T> Prepend<&'b Bump> for BRVec<'b, T> {
14 type Item = T;
15 fn empty(with: &'b Bump) -> Self {
16 Self(bumpalo::collections::Vec::new_in(with))
17 }
18 fn prepend(&mut self, value: Self::Item, _: &'b Bump) {
19 let Self(inner) = self;
20 inner.push(value);
21 }
22}
23
24impl<'b, T: Debug> Debug for BRVec<'b, T> {
25 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
26 f.debug_list().entries(self.0.iter().rev()).finish()
27 }
28}
29
30impl<'b, T> IntoIterator for BRVec<'b, T> {
31 type Item = T;
32 type IntoIter = core::iter::Rev<bumpalo::collections::vec::IntoIter<'b, T>>;
33 fn into_iter(self) -> Self::IntoIter {
34 let Self(inner) = self;
35 inner.into_iter().rev()
36 }
37}