Struct core_traits::Attribute
[−]
[src]
pub struct Attribute { pub value_type: ValueType, pub multival: bool, pub unique: Option<Unique>, pub index: bool, pub fulltext: bool, pub component: bool, pub no_history: bool, }
A Mentat schema attribute has a value type and several other flags determining how assertions with the attribute are interpreted.
TODO: consider packing this into a bitfield or similar.
Fields
value_type: ValueType
The associated value type, i.e., :db/valueType
?
multival: bool
true
if this attribute is multi-valued, i.e., it is :db/cardinality :db.cardinality/many
. false
if this attribute is single-valued (the default), i.e., it
is :db/cardinality :db.cardinality/one
.
unique: Option<Unique>
None
if this attribute is neither unique-value nor unique-identity.
Some(attribute::Unique::Value)
if this attribute is unique-value, i.e., it is :db/unique :db.unique/value
.
Unique-value means that there is at most one assertion with the attribute and a particular value in the datom store. Unique-value attributes can be used in lookup-refs.
Some(attribute::Unique::Identity)
if this attribute is unique-identity, i.e., it is :db/unique :db.unique/identity
.
Unique-identity attributes always have value type Ref
.
Unique-identity means that the attribute is unique-value and that they can be used in lookup-refs and will automatically upsert where appropriate.
index: bool
true
if this attribute is automatically indexed, i.e., it is :db/indexing true
.
fulltext: bool
true
if this attribute is automatically fulltext indexed, i.e., it is :db/fulltext true
.
Fulltext attributes always have string values.
component: bool
true
if this attribute is a component, i.e., it is :db/isComponent true
.
Component attributes always have value type Ref
.
They are used to compose entities from component sub-entities: they are fetched recursively by pull expressions, and they are automatically recursively deleted where appropriate.
no_history: bool
true
if this attribute doesn't require history to be kept, i.e., it is :db/noHistory true
.
Methods
impl Attribute
[src]
pub fn flags(&self) -> u8
[src]
Combine several attribute flags into a bitfield used in temporary search tables.
pub fn to_edn_value(&self, ident: Option<Keyword>) -> Value
[src]
Trait Implementations
impl Clone for Attribute
[src]
fn clone(&self) -> Attribute
[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 Attribute
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Eq for Attribute
[src]
impl Hash for Attribute
[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 Attribute
[src]
fn cmp(&self, __arg_0: &Attribute) -> 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 Attribute
[src]
fn partial_cmp(&self, __arg_0: &Attribute) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Attribute) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Attribute) -> 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: &Attribute) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Attribute) -> 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 Attribute
[src]
fn eq(&self, __arg_0: &Attribute) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Attribute) -> bool
[src]
This method tests for !=
.