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