Struct mentat_core::Schema
[−]
[src]
pub struct Schema { pub entid_map: EntidMap, pub ident_map: IdentMap, pub attribute_map: AttributeMap, pub component_attributes: Vec<Entid>, }
Represents a Mentat schema.
Maintains the mapping between string idents and positive integer entids; and exposes the schema flags associated to a given entid (equivalently, ident).
TODO: consider a single bi-directional map instead of separate ident->entid and entid->ident maps.
Fields
entid_map: EntidMap
Map entid->ident.
Invariant: is the inverse map of ident_map
.
ident_map: IdentMap
Map ident->entid.
Invariant: is the inverse map of entid_map
.
attribute_map: AttributeMap
Map entid->attribute flags.
Invariant: key-set is the same as the key-set of entid_map
(equivalently, the value-set of
ident_map
).
component_attributes: Vec<Entid>
Maintain a vec of unique attribute IDs for which the corresponding attribute in attribute_map
has .component == true
.
Methods
impl Schema
[src]
pub fn new(
ident_map: IdentMap,
entid_map: EntidMap,
attribute_map: AttributeMap
) -> Schema
[src]
ident_map: IdentMap,
entid_map: EntidMap,
attribute_map: AttributeMap
) -> Schema
pub fn to_edn_value(&self) -> Value
[src]
Returns an symbolic representation of the schema suitable for applying across Mentat stores.
pub fn update_component_attributes(&mut self)
[src]
Trait Implementations
impl Clone for Schema
[src]
fn clone(&self) -> Schema
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Schema
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Default for Schema
[src]
impl Eq for Schema
[src]
impl Hash for Schema
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Schema
[src]
fn cmp(&self, __arg_0: &Schema) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for Schema
[src]
fn partial_cmp(&self, __arg_0: &Schema) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Schema) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Schema) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Schema) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Schema) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq for Schema
[src]
fn eq(&self, __arg_0: &Schema) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Schema) -> bool
[src]
This method tests for !=
.
impl HasSchema for Schema
[src]
fn entid_for_type(&self, t: ValueType) -> Option<KnownEntid>
[src]
fn get_ident<T>(&self, x: T) -> Option<&Keyword> where
T: Into<Entid>,
[src]
T: Into<Entid>,
fn get_entid(&self, x: &Keyword) -> Option<KnownEntid>
[src]
fn attribute_for_entid<T>(&self, x: T) -> Option<&Attribute> where
T: Into<Entid>,
[src]
T: Into<Entid>,
fn attribute_for_ident(
&self,
ident: &Keyword
) -> Option<(&Attribute, KnownEntid)>
[src]
&self,
ident: &Keyword
) -> Option<(&Attribute, KnownEntid)>
fn is_attribute<T>(&self, x: T) -> bool where
T: Into<Entid>,
[src]
T: Into<Entid>,
Return true if the provided entid identifies an attribute in this schema.
fn identifies_attribute(&self, x: &Keyword) -> bool
[src]
Return true if the provided ident identifies an attribute in this schema.