#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] pub struct SourceId(pub u32); #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Span { pub source: SourceId, pub start: u32, pub end: u32, } impl Span { pub const fn new(source: SourceId, start: usize, end: usize) -> Self { Self { source, start: start as u32, end: end as u32, } } pub const fn empty(source: SourceId, offset: usize) -> Self { Self::new(source, offset, offset) } pub fn join(self, other: Self) -> Self { Self { source: self.source, start: self.start.min(other.start), end: self.end.max(other.end), } } }