1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use bumpalo::Bump;
use std::fmt::{Debug, Formatter};

/// Holds data for a [`ScopeGraph`](crate::ScopeGraph). Required to construct a `ScopeGraph`.
///
/// A `ScopeGraph` will use the storage object to allocate in,
/// and lifetimes of items in the scope graph will be tied to an instance of `Storage`.
#[derive(Default)]
pub struct Storage(pub Bump);

impl Debug for Storage {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "<scopegraph storage>")
    }
}

impl Storage {
    /// Creates a new storage object.
    pub fn new() -> Self {
        Self(Bump::new())
    }
}