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,
}Expand description
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: ValueTypeThe associated value type, i.e., :db/valueType?
multival: booltrue 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: booltrue if this attribute is automatically indexed, i.e., it is :db/indexing true.
fulltext: booltrue if this attribute is automatically fulltext indexed, i.e., it is :db/fulltext true.
Fulltext attributes always have string values.
component: booltrue 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: booltrue if this attribute doesn’t require history to be kept, i.e., it is :db/noHistory true.
Implementations§
Trait Implementations§
Source§impl AttributeValidation for Attribute
impl AttributeValidation for Attribute
impl Eq for Attribute
Source§impl Ord for Attribute
impl Ord for Attribute
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Attribute
impl PartialOrd for Attribute
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnsafeUnpin for Attribute
impl UnwindSafe for Attribute
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more