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]
impl Schema
pub fn new(
ident_map: IdentMap,
entid_map: EntidMap,
attribute_map: AttributeMap
) -> Schema
[src]
pub fn new(
ident_map: IdentMap,
entid_map: EntidMap,
attribute_map: AttributeMap
) -> Schema
pub fn to_edn_value(&self) -> Value
[src]
pub fn to_edn_value(&self) -> Value
Returns an symbolic representation of the schema suitable for applying across Mentat stores.
pub fn update_component_attributes(&mut self)
[src]
pub fn update_component_attributes(&mut self)
Trait Implementations
impl Clone for Schema
[src]
impl Clone for Schema
fn clone(&self) -> Schema
[src]
fn clone(&self) -> Schema
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Schema
[src]
impl Debug for Schema
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Schema
[src]
impl Default for Schema
impl Eq for Schema
[src]
impl Eq for Schema
impl Hash for Schema
[src]
impl Hash for Schema
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Schema
[src]
impl Ord for Schema
fn cmp(&self, __arg_0: &Schema) -> Ordering
[src]
fn cmp(&self, __arg_0: &Schema) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Schema
[src]
impl PartialOrd for Schema
fn partial_cmp(&self, __arg_0: &Schema) -> Option<Ordering>
[src]
fn partial_cmp(&self, __arg_0: &Schema) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Schema) -> bool
[src]
fn lt(&self, __arg_0: &Schema) -> bool
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]
fn le(&self, __arg_0: &Schema) -> bool
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]
fn gt(&self, __arg_0: &Schema) -> bool
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]
fn ge(&self, __arg_0: &Schema) -> bool
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]
impl PartialEq for Schema
fn eq(&self, __arg_0: &Schema) -> bool
[src]
fn eq(&self, __arg_0: &Schema) -> bool
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]
fn ne(&self, __arg_0: &Schema) -> bool
This method tests for !=
.
impl HasSchema for Schema
[src]
impl HasSchema for Schema
fn entid_for_type(&self, t: ValueType) -> Option<KnownEntid>
[src]
fn entid_for_type(&self, t: ValueType) -> Option<KnownEntid>
fn get_ident<T>(&self, x: T) -> Option<&Keyword> where
T: Into<Entid>,
[src]
fn get_ident<T>(&self, x: T) -> Option<&Keyword> where
T: Into<Entid>,
fn get_entid(&self, x: &Keyword) -> Option<KnownEntid>
[src]
fn get_entid(&self, x: &Keyword) -> Option<KnownEntid>
fn attribute_for_entid<T>(&self, x: T) -> Option<&Attribute> where
T: Into<Entid>,
[src]
fn attribute_for_entid<T>(&self, x: T) -> Option<&Attribute> where
T: Into<Entid>,
fn attribute_for_ident(
&self,
ident: &Keyword
) -> Option<(&Attribute, KnownEntid)>
[src]
fn attribute_for_ident(
&self,
ident: &Keyword
) -> Option<(&Attribute, KnownEntid)>
fn is_attribute<T>(&self, x: T) -> bool where
T: Into<Entid>,
[src]
fn is_attribute<T>(&self, x: T) -> bool where
T: Into<Entid>,
Return true if the provided entid identifies an attribute in this schema.
fn identifies_attribute(&self, x: &Keyword) -> bool
[src]
fn identifies_attribute(&self, x: &Keyword) -> bool
Return true if the provided ident identifies an attribute in this schema.
fn component_attributes(&self) -> &[Entid]
[src]
fn component_attributes(&self) -> &[Entid]