Skip to main content

Model

Struct Model 

Source
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 16-byte ranges plus a 1-byte flags column (17 bytes/site), grouped by relation (CSR); their file is the file of the relation’s source entity.

Implementations§

Source§

impl Model

Source

pub fn entity_count(&self) -> usize

Source

pub fn relation_count(&self) -> usize

Source

pub fn site_count(&self) -> usize

Source

pub fn entity(&self, id: EntityId) -> Option<EntityRef<'_>>

Source

pub fn by_key(&self, key: &str) -> Option<EntityRef<'_>>

Source

pub fn entities(&self) -> impl ExactSizeIterator<Item = EntityRef<'_>>

Source

pub fn of_kind(&self, kind: EntityKind) -> impl Iterator<Item = EntityRef<'_>>

Entities of an archetype, whatever their fine kind.

Source

pub fn of_kind_id(&self, kind: KindId) -> impl Iterator<Item = EntityRef<'_>>

Entities of exactly this fine kind.

Source

pub fn of_trait(&self, traits: TraitMask) -> impl Iterator<Item = EntityRef<'_>>

Entities whose kind carries every trait of traits. Bit meanings are defined by the metamodel’s author (see the model-traits crate).

Source

pub fn metamodel(&self) -> &Metamodel

Kinds of this model: archetype, traits and FM3 class of each.

Source

pub fn roots(&self) -> impl Iterator<Item = EntityRef<'_>>

Source

pub fn relation(&self, id: RelationId) -> Option<RelationRef<'_>>

Source

pub fn relations(&self) -> impl ExactSizeIterator<Item = RelationRef<'_>>

Source

pub fn languages(&self) -> &[LanguageId]

Languages present, in first-seen order.

Source

pub fn memory(&self) -> MemoryStats

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Model

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Model

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Model

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. 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
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for Model
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for Model
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin,

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model
where RawVecInner: UnwindSafe, BTreeMap<String, Value>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.