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§
Sourcefn is_abstract(&self) -> bool
fn is_abstract(&self) -> bool
Checks if the type is prevented from having data instances (i.e. abstract).
§Examples
thing_type.is_abstract();fn to_thing_type_cloned(&self) -> ThingType
Sourcefn is_deleted<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result<bool>>
fn is_deleted<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result<bool>>
Provided Methods§
Sourcefn delete<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result>
fn delete<'tx>( &mut self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result>
Sourcefn set_label<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
new_label: String,
) -> BoxPromise<'tx, Result>
fn set_label<'tx>( &mut self, transaction: &'tx Transaction<'_>, new_label: String, ) -> BoxPromise<'tx, Result>
Sourcefn set_abstract<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result>
fn set_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result>
Sourcefn unset_abstract<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result>
fn unset_abstract<'tx>( &mut self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result>
Sourcefn get_owns<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value_type: Option<ValueType>,
transitivity: Transitivity,
annotations: Vec<Annotation>,
) -> Result<BoxStream<'tx, Result<AttributeType>>>
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 transactionvalue_type– If specified, only attribute types of thisValueTypewill be retrieved.transitivity–Transitivity::Transitivefor direct and inherited ownership,Transitivity::Explicitfor direct ownership onlyannotations– Only retrieve attribute types owned with annotations.
§Examples
thing_type.get_owns(transaction, Some(value_type), Transitivity::Explicit, vec![Annotation::Key]).await;Sourcefn get_owns_overridden<'tx>(
&self,
transaction: &'tx Transaction<'_>,
overridden_attribute_type: AttributeType,
) -> BoxPromise<'tx, Result<Option<AttributeType>>>
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 transactionoverridden_attribute_type– TheAttributeTypethat overrides requestedAttributeType
§Examples
thing_type.get_owns_overridden(transaction, attribute_type).await;Sourcefn set_owns<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
attribute_type: AttributeType,
overridden_attribute_type: Option<AttributeType>,
annotations: Vec<Annotation>,
) -> BoxPromise<'tx, Result>
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 transactionattribute_type– TheAttributeTypeto be owned by the instances of this type.overridden_attribute_type– TheAttributeTypethat 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;Sourcefn unset_owns<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
attribute_type: AttributeType,
) -> BoxPromise<'tx, Result>
fn unset_owns<'tx>( &mut self, transaction: &'tx Transaction<'_>, attribute_type: AttributeType, ) -> BoxPromise<'tx, Result>
Sourcefn get_plays<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
) -> Result<BoxStream<'tx, Result<RoleType>>>
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 transactiontransitivity–Transitivity::Transitivefor direct and indirect playing,Transitivity::Explicitfor direct playing only
§Examples
thing_type.get_plays(transaction, Transitivity::Explicit).await;Sourcefn get_plays_overridden<'tx>(
&self,
transaction: &'tx Transaction<'_>,
overridden_role_type: RoleType,
) -> BoxPromise<'tx, Result<Option<RoleType>>>
fn get_plays_overridden<'tx>( &self, transaction: &'tx Transaction<'_>, overridden_role_type: RoleType, ) -> BoxPromise<'tx, Result<Option<RoleType>>>
Sourcefn set_plays<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
role_type: RoleType,
overridden_role_type: Option<RoleType>,
) -> BoxPromise<'tx, Result>
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 transactionrole_type– The role to be played by the instances of this typeoverridden_role_type– The role type that this role overrides, if applicable
§Examples
thing_type.set_plays(transaction, role_type, None).await;