mod display;
use super::*;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum NamespaceKind {
Shared,
Unique,
Test,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NamespaceDeclaration {
pub kind: NamespaceKind,
pub path: Vec<IdentifierNode>,
pub span: Range<u32>,
}
impl NamespaceDeclaration {
pub fn new<I>(names: I, range: Range<u32>) -> Self
where
I: IntoIterator<Item = IdentifierNode>,
{
Self { kind: NamespaceKind::Unique, path: names.into_iter().collect(), span: range.clone() }
}
pub fn with_kind(mut self, kind: NamespaceKind) -> Self {
self.kind = kind;
self
}
}