pub trait RoleTypeAPI: Clone + Into<RoleType> + Sync + Send {
    // Required methods
    fn is_abstract(&self) -> bool;
    fn is_deleted<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result<bool>>;
    fn get_relation_type<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result<Option<RelationType>>>;

    // Provided methods
    fn delete<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result> { ... }
    fn set_label<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        new_label: String
    ) -> BoxPromise<'tx, Result> { ... }
    fn get_supertype<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result<Option<RoleType>>> { ... }
    fn get_supertypes<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> Result<BoxStream<'tx, Result<RoleType>>> { ... }
    fn get_subtypes<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<RoleType>>> { ... }
    fn get_relation_types<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> Result<BoxStream<'tx, Result<RelationType>>> { ... }
    fn get_player_types<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<ThingType>>> { ... }
    fn get_relation_instances<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<Relation>>> { ... }
    fn get_player_instances<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<Thing>>> { ... }
}

Required Methods§

source

fn is_abstract(&self) -> bool

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

§Examples
role_type.is_abstract()
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
role_type.is_deleted(transaction).await;
source

fn get_relation_type<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<Option<RelationType>>>

Retrieves the RelationType that this role is directly related to.

§Arguments
  • transaction – The current transaction
§Examples
role_type.get_relation_type(transaction).await;

Provided Methods§

source

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

Deletes this type from the database.

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

fn set_label<'tx>( &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
role_type.set_label(transaction, new_label).await;
source

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

Retrieves the most immediate supertype of the RoleType.

§Arguments
  • transaction – The current transaction
§Examples
role_type.get_supertype(transaction).await;
source

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

Retrieves all supertypes of the RoleType.

§Arguments
  • transaction – The current transaction
§Examples
role_type.get_supertypes(transaction)
source

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

Retrieves all direct and indirect (or direct only) subtypes of the RoleType.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect subtypes, Transitivity::Explicit for direct subtypes only
§Examples
role_type.get_subtypes(transaction, transitivity)
source

fn get_relation_types<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<RelationType>>>

Retrieves RelationTypes that this role is related to (directly or indirectly).

§Arguments
  • transaction – The current transaction
§Examples
role_type.get_relation_types(transaction)
source

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

Retrieves the ThingTypes whose instances play this role.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect playing, Transitivity::Explicit for direct playing only
§Examples
role_type.get_player_types(transaction, transitivity)
source

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

Retrieves the Relation instances that this role is related to.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect relation, Transitivity::Explicit for direct relation only
§Examples
role_type.get_relation_instances(transaction, transitivity)
source

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

Retrieves the Thing instances that play this role.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect playing, Transitivity::Explicit for direct playing only
§Examples
role_type.get_player_instances(transaction, transitivity)

Object Safety§

This trait is not object safe.

Implementors§