use crate::schema::builder::ValueInterner;
use crate::schema::interner::Interner;
use crate::schema::layout::SlotLayout;
use crate::{AttrId, KindId};
#[derive(Debug)]
pub struct Schema {
pub kind_names: Interner<KindId>,
pub attr_names: Interner<AttrId>,
pub value_interner: ValueInterner,
pub slot_layout: SlotLayout,
}
impl Schema {
#[must_use]
pub fn kind(&self, name: &str) -> Option<KindId> {
self.kind_names.get(name)
}
#[must_use]
pub fn attr(&self, name: &str) -> Option<AttrId> {
self.attr_names.get(name)
}
#[must_use]
pub fn kind_name(&self, id: KindId) -> &str {
self.kind_names.lookup(id)
}
#[must_use]
pub fn attr_name(&self, id: AttrId) -> &str {
self.attr_names.lookup(id)
}
}