1mod decls;
2mod exprs;
3mod misc;
4mod names;
5mod stmts;
6
7pub use decls::*;
8pub use exprs::*;
9pub use misc::*;
10pub use names::*;
11pub use stmts::*;
12
13pub(crate) fn is_false(b: &bool) -> bool {
14 !*b
15}
16
17pub struct ArenaVec<'arena, T>(bumpalo::collections::Vec<'arena, T>);
19
20impl<'arena, T> ArenaVec<'arena, T> {
21 #[inline]
23 pub fn new_in(arena: &'arena bumpalo::Bump) -> Self {
24 Self(bumpalo::collections::Vec::new_in(arena))
25 }
26 #[inline]
28 pub fn with_capacity_in(cap: usize, arena: &'arena bumpalo::Bump) -> Self {
29 Self(bumpalo::collections::Vec::with_capacity_in(cap, arena))
30 }
31 #[inline]
33 pub fn push(&mut self, val: T) {
34 self.0.push(val)
35 }
36 #[inline]
39 pub fn is_empty(&self) -> bool {
40 self.0.is_empty()
41 }
42}
43
44impl<'arena, T> IntoIterator for ArenaVec<'arena, T> {
45 type Item = T;
46 type IntoIter = bumpalo::collections::vec::IntoIter<'arena, T>;
47 #[inline]
48 fn into_iter(self) -> Self::IntoIter {
49 self.0.into_iter()
50 }
51}
52
53impl<'arena, T> std::ops::Deref for ArenaVec<'arena, T> {
54 type Target = [T];
55 #[inline]
56 fn deref(&self) -> &[T] {
57 &self.0
58 }
59}
60
61impl<'arena, T> std::ops::DerefMut for ArenaVec<'arena, T> {
62 #[inline]
63 fn deref_mut(&mut self) -> &mut [T] {
64 &mut self.0
65 }
66}
67
68impl<'arena, T: serde::Serialize> serde::Serialize for ArenaVec<'arena, T> {
69 fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
70 self.0.as_slice().serialize(s)
71 }
72}
73
74impl<'arena, T: std::fmt::Debug> std::fmt::Debug for ArenaVec<'arena, T> {
75 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
76 self.0.as_slice().fmt(f)
77 }
78}