use std::collections::HashSet;
#[derive(Debug, Clone, Default)]
pub struct VendorExtensionRegistry {
allowed_ops: HashSet<String>,
}
impl VendorExtensionRegistry {
pub fn new() -> Self {
Self {
allowed_ops: HashSet::new(),
}
}
pub fn register(&mut self, op: impl Into<String>) {
self.allowed_ops.insert(op.into());
}
pub fn register_many<I, S>(&mut self, ops: I)
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for op in ops {
self.register(op);
}
}
pub fn is_allowed(&self, op: &str) -> bool {
self.allowed_ops.contains(op)
}
}