1pub struct Arena {
11 bump: bumpalo::Bump,
12}
13
14impl Default for Arena {
15 fn default() -> Self {
16 Self::new()
17 }
18}
19
20impl Arena {
21 pub fn new() -> Self {
22 Self {
23 bump: bumpalo::Bump::new(),
24 }
25 }
26
27 pub fn alloc<T: Copy>(&self, value: T) -> &T {
28 self.bump.alloc(value)
29 }
30
31 pub fn alloc_slice<T: Copy>(&self, slice: &[T]) -> &[T] {
32 self.bump.alloc_slice_copy(slice)
33 }
34
35 pub fn alloc_str(&self, value: &str) -> &str {
36 self.bump.alloc_str(value)
37 }
38}