use std::collections::HashSet;
use std::hash::Hash;
pub(crate) struct ParsingState<T: Hash + Eq> {
pub has_all: bool,
pub include: HashSet<T>,
pub exclude: HashSet<String>,
}
impl<T: Hash + Eq> Default for ParsingState<T> {
fn default() -> Self {
Self {
has_all: false,
include: HashSet::new(),
exclude: HashSet::new(),
}
}
}
pub(crate) fn split_ns(name: &str) -> (&str, &str) {
match name.rsplit_once('.') {
Some((ns, leaf)) => (ns, leaf),
None => ("", name),
}
}
pub(crate) fn qualify(resource: &str, name: &str) -> String {
if name.contains('.') {
name.to_string()
} else {
format!("{resource}.{name}")
}
}