pub trait RelationTypeAPI: ThingTypeAPI + Clone + Into<RelationType> {
    // Provided methods
    fn create<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result<Relation>> { ... }
    fn get_supertype<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> BoxPromise<'tx, Result<Option<RelationType>>> { ... }
    fn set_supertype<'tx>(
        &mut self,
        transaction: &'tx Transaction<'_>,
        supertype: RelationType
    ) -> BoxPromise<'tx, Result> { ... }
    fn get_supertypes<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> Result<BoxStream<'tx, Result<RelationType>>> { ... }
    fn get_subtypes<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<RelationType>>> { ... }
    fn get_instances<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<Relation>>> { ... }
    fn get_relates<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        transitivity: Transitivity
    ) -> Result<BoxStream<'tx, Result<RoleType>>> { ... }
    fn get_relates_for_role_label<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        role_label: String
    ) -> BoxPromise<'tx, Result<Option<RoleType>>> { ... }
    fn get_relates_overridden<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        overridden_role_label: String
    ) -> BoxPromise<'tx, Result<Option<RoleType>>> { ... }
    fn set_relates<'tx>(
        &mut self,
        transaction: &'tx Transaction<'_>,
        role_label: String,
        overridden_role_label: Option<String>
    ) -> BoxPromise<'tx, Result> { ... }
    fn unset_relates<'tx>(
        &mut self,
        transaction: &'tx Transaction<'_>,
        role_label: String
    ) -> BoxPromise<'tx, Result> { ... }
}

Provided Methods§

source

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

Creates and returns an instance of this RelationType.

Arguments
  • transaction – The current transaction
Examples
relation_type.create(transaction).await;
source

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

Retrieves the most immediate supertype of the RelationType.

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

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

Sets the supplied RelationType as the supertype of the current RelationType.

Arguments
  • transaction – The current transaction
  • supertype – The RelationType to set as the supertype of this RelationType
Examples
relation_type.set_supertype(transaction, super_relation_type).await;
source

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

Retrieves all supertypes of the RelationType.

Arguments
  • transaction – The current transaction
Examples
relation_type.get_supertypes(transaction);
source

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

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

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

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

Retrieves all direct and indirect (or direct only) Relations that are instances of this RelationType.

Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and indirect instances, Transitivity::Explicit for direct relates only
Examples
relation_type.get_instances(transaction, Transitivity::Explicit);
source

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

Retrieves roles that this RelationType relates to directly or via inheritance.

Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and inherited relates, Transitivity::Explicit for direct relates only
Examples
relation_type.get_relates(transaction, Transitivity::Transitive);
source

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

Retrieves role with a given role_label that this RelationType relates to.

Arguments
  • transaction – The current transaction
  • role_label – Label of the role we wish to retrieve
Examples
relation_type.get_relates_for_role_label(transaction, role_label).await;
source

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

Retrieves a RoleType that is overridden by the role with the overridden_role_label.

Arguments
  • transaction – The current transaction
  • overridden_role_label – Label of the role that overrides an inherited role
Examples
relation_type.get_relates_overridden(transaction, overridden_role_label).await;
source

fn set_relates<'tx>( &mut self, transaction: &'tx Transaction<'_>, role_label: String, overridden_role_label: Option<String> ) -> BoxPromise<'tx, Result>

Sets the new role that this RelationType relates to. If we are setting an overriding type this way, we have to also pass the overridden type as a second argument.

Arguments
  • transaction – The current transaction
  • role_label – The new role for the RelationType to relate to
  • overridden_role_label – The label being overridden, if applicable
Examples
relation_type.set_relates(transaction, role_label, None).await;
source

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

Disallows this RelationType from relating to the given role.

Arguments
  • transaction – The current transaction
  • role_label – The role to not relate to the relation type.
Examples
relation_type.unset_relates(transaction, role_label).await;

Object Safety§

This trait is not object safe.

Implementors§