pub trait ThingTypeAPI: Sync + Send {
Show 18 methods // Required methods fn label(&self) -> &str; fn is_abstract(&self) -> bool; fn is_root(&self) -> bool; fn to_thing_type_cloned(&self) -> ThingType; fn is_deleted<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<bool>>; // Provided methods fn delete<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result> { ... } fn set_label<'tx>( &mut self, transaction: &'tx Transaction<'_>, new_label: String ) -> BoxPromise<'tx, Result> { ... } fn set_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result> { ... } fn unset_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result> { ... } fn get_owns<'tx>( &self, transaction: &'tx Transaction<'_>, value_type: Option<ValueType>, transitivity: Transitivity, annotations: Vec<Annotation> ) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... } fn get_owns_overridden<'tx>( &self, transaction: &'tx Transaction<'_>, overridden_attribute_type: AttributeType ) -> BoxPromise<'tx, Result<Option<AttributeType>>> { ... } fn set_owns<'tx>( &mut self, transaction: &'tx Transaction<'_>, attribute_type: AttributeType, overridden_attribute_type: Option<AttributeType>, annotations: Vec<Annotation> ) -> BoxPromise<'tx, Result> { ... } fn unset_owns<'tx>( &mut self, transaction: &'tx Transaction<'_>, attribute_type: AttributeType ) -> BoxPromise<'tx, Result> { ... } fn get_plays<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<RoleType>>> { ... } fn get_plays_overridden<'tx>( &self, transaction: &'tx Transaction<'_>, overridden_role_type: RoleType ) -> BoxPromise<'tx, Result<Option<RoleType>>> { ... } fn set_plays<'tx>( &mut self, transaction: &'tx Transaction<'_>, role_type: RoleType, overridden_role_type: Option<RoleType> ) -> BoxPromise<'tx, Result> { ... } fn unset_plays<'tx>( &mut self, transaction: &'tx Transaction<'_>, role_type: RoleType ) -> BoxPromise<'tx, Result> { ... } fn get_syntax<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<String>> { ... }
}

Required Methods§

source

fn label(&self) -> &str

Retrieves the unique label of the type.

§Examples
thing_type.label();
source

fn is_abstract(&self) -> bool

Checks if the type is prevented from having data instances (i.e. abstract).

§Examples
thing_type.is_abstract();
source

fn is_root(&self) -> bool

Checks if the type is a root type.

§Examples
thing_type.is_root();
source

fn to_thing_type_cloned(&self) -> ThingType

source

fn is_deleted<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<bool>>

Checks if this type is deleted.

§Arguments
  • transaction – The current transaction
§Examples
thing_type.is_deleted(transaction).await;

Provided Methods§

source

fn delete<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result>

Deletes this type from the database.

§Arguments
  • transaction – The current transaction
§Examples
thing_type.delete(transaction).await;
source

fn set_label<'tx>( &mut self, transaction: &'tx Transaction<'_>, new_label: String ) -> BoxPromise<'tx, Result>

Renames the label of the type. The new label must remain unique.

§Arguments
  • transaction – The current transaction
  • new_label – The new Label to be given to the type.
§Examples
thing_type.set_label(transaction, new_label).await;
source

fn set_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result>

Set a type to be abstract, meaning it cannot have instances.

§Arguments
  • transaction – The current transaction
§Examples
thing_type.set_abstract(transaction).await;
source

fn unset_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result>

Set a type to be non-abstract, meaning it can have instances.

§Arguments
  • transaction – The current transaction
§Examples
thing_type.unset_abstract(transaction).await;
source

fn get_owns<'tx>( &self, transaction: &'tx Transaction<'_>, value_type: Option<ValueType>, transitivity: Transitivity, annotations: Vec<Annotation> ) -> Result<BoxStream<'tx, Result<AttributeType>>>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

§Arguments
  • transaction – The current transaction
  • value_type – If specified, only attribute types of this ValueType will be retrieved.
  • transitivityTransitivity::Transitive for direct and inherited ownership, Transitivity::Explicit for direct ownership only
  • annotations – Only retrieve attribute types owned with annotations.
§Examples
thing_type.get_owns(transaction, Some(value_type), Transitivity::Explicit, vec![Annotation::Key]).await;
source

fn get_owns_overridden<'tx>( &self, transaction: &'tx Transaction<'_>, overridden_attribute_type: AttributeType ) -> BoxPromise<'tx, Result<Option<AttributeType>>>

Retrieves an AttributeType, ownership of which is overridden for this ThingType by a given attribute_type.

§Arguments
  • transaction – The current transaction
  • overridden_attribute_type – The AttributeType that overrides requested AttributeType
§Examples
thing_type.get_owns_overridden(transaction, attribute_type).await;
source

fn set_owns<'tx>( &mut self, transaction: &'tx Transaction<'_>, attribute_type: AttributeType, overridden_attribute_type: Option<AttributeType>, annotations: Vec<Annotation> ) -> BoxPromise<'tx, Result>

Allows the instances of this ThingType to own the given AttributeType.

§Arguments
  • transaction – The current transaction
  • attribute_type – The AttributeType to be owned by the instances of this type.
  • overridden_attribute_type – The AttributeType that this attribute ownership overrides, if applicable.
  • annotations – Adds annotations to the ownership.
§Examples
thing_type.set_owns(transaction, attribute_type, Some(overridden_type), vec![Annotation::Key]).await;
source

fn unset_owns<'tx>( &mut self, transaction: &'tx Transaction<'_>, attribute_type: AttributeType ) -> BoxPromise<'tx, Result>

Disallows the instances of this ThingType from owning the given AttributeType.

§Arguments
  • transaction – The current transaction
  • attribute_type – The AttributeType to not be owned by the type.
§Examples
thing_type.unset_owns(transaction, attribute_type).await;
source

fn get_plays<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<RoleType>>>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect playing, Transitivity::Explicit for direct playing only
§Examples
thing_type.get_plays(transaction, Transitivity::Explicit).await;
source

fn get_plays_overridden<'tx>( &self, transaction: &'tx Transaction<'_>, overridden_role_type: RoleType ) -> BoxPromise<'tx, Result<Option<RoleType>>>

Retrieves a RoleType that is overridden by the given role_type for this ThingType.

§Arguments
  • transaction – The current transaction
  • overridden_role_type – The RoleType that overrides an inherited role
§Examples
thing_type.get_plays_overridden(transaction, role_type).await;
source

fn set_plays<'tx>( &mut self, transaction: &'tx Transaction<'_>, role_type: RoleType, overridden_role_type: Option<RoleType> ) -> BoxPromise<'tx, Result>

Allows the instances of this ThingType to play the given role.

§Arguments
  • transaction – The current transaction
  • role_type – The role to be played by the instances of this type
  • overridden_role_type – The role type that this role overrides, if applicable
§Examples
thing_type.set_plays(transaction, role_type, None).await;
source

fn unset_plays<'tx>( &mut self, transaction: &'tx Transaction<'_>, role_type: RoleType ) -> BoxPromise<'tx, Result>

Disallows the instances of this ThingType from playing the given role.

§Arguments
  • transaction – The current transaction
  • role_type – The role to not be played by the instances of this type.
§Examples
thing_type.unset_plays(transaction, role_type).await;
source

fn get_syntax<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<String>>

Produces a pattern for creating this ThingType in a define query.

§Arguments
  • transaction – The current transaction
§Examples
thing_type.get_syntax(transaction).await;

Implementors§