pub struct Model { /* private fields */ }Expand description
Frozen, compact model.
Layout, chosen to keep every occurrence affordable:
- strings (keys, names, files) interned once in a single buffer;
- fixed-size entity rows, sparse props;
- relations deduplicated and sorted by source, so the outgoing relations of an entity are one slice (CSR); incoming ones are an index array;
- occurrence sites stored as bare 16-byte ranges, grouped by relation (CSR); their file is the file of the relation’s source entity.
Implementations§
Source§impl Model
impl Model
pub fn entity_count(&self) -> usize
pub fn relation_count(&self) -> usize
pub fn site_count(&self) -> usize
pub fn entity(&self, id: EntityId) -> Option<EntityRef<'_>>
pub fn by_key(&self, key: &str) -> Option<EntityRef<'_>>
pub fn entities(&self) -> impl ExactSizeIterator<Item = EntityRef<'_>>
pub fn of_kind(&self, kind: EntityKind) -> impl Iterator<Item = EntityRef<'_>>
pub fn roots(&self) -> impl Iterator<Item = EntityRef<'_>>
pub fn relation(&self, id: RelationId) -> Option<RelationRef<'_>>
pub fn relations(&self) -> impl ExactSizeIterator<Item = RelationRef<'_>>
Sourcepub fn languages(&self) -> &[LanguageId]
pub fn languages(&self) -> &[LanguageId]
Languages present, in first-seen order.
pub fn memory(&self) -> MemoryStats
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for Model
impl Freeze for Model
impl Move for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more