ligen_parser/
utils.rs

1#[derive(Debug)]
2pub struct WithSource<T> {
3    pub source: String,
4    pub ast: T
5}
6
7impl<T> WithSource<T> {
8    pub fn new(source: impl AsRef<str>, ast: T) -> Self {
9        let source = source.as_ref().to_string();
10        Self { source, ast }
11    }
12
13    pub fn sub<U>(&self, ast: U) -> WithSource<U> {
14        WithSource::new(&self.source, ast)
15    }
16}