pub trait AttributeTypeAPI: ThingTypeAPI + Clone + Into<AttributeType> {
Show 13 methods // Required method fn value_type(&self) -> ValueType; // Provided methods fn put<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Attribute>> { ... } fn get<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Option<Attribute>>> { ... } fn get_supertype<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<Option<AttributeType>>> { ... } fn set_supertype<'tx>( &mut self, transaction: &'tx Transaction<'_>, supertype: AttributeType ) -> BoxPromise<'tx, Result> { ... } fn get_supertypes<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... } fn get_subtypes<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... } fn get_subtypes_with_value_type<'tx>( &self, transaction: &'tx Transaction<'_>, value_type: ValueType, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... } fn get_instances<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<Attribute>>> { ... } fn get_regex<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<Option<String>>> { ... } fn set_regex<'tx>( &self, transaction: &'tx Transaction<'_>, regex: String ) -> BoxPromise<'tx, Result> { ... } fn unset_regex<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result> { ... } fn get_owners<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, annotations: Vec<Annotation> ) -> Result<BoxStream<'tx, Result<ThingType>>> { ... }
}

Required Methods§

source

fn value_type(&self) -> ValueType

Retrieves the ValueType of this AttributeType.

§Examples
attribute_type.value_type()

Provided Methods§

source

fn put<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Attribute>>

Adds and returns an Attribute of this AttributeType with the given value.

§Arguments
  • transaction – The current transaction
  • value – New Attribute’s value
§Examples
attribute = attribute_type.put(transaction, value).await;
source

fn get<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Option<Attribute>>>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

§Arguments
  • transaction – The current transaction
  • valueAttribute’s value
§Examples
attribute = attribute_type.get(transaction, value).await;
source

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

Retrieves the most immediate supertype of this AttributeType.

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

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

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

§Arguments
  • transaction – The current transaction
  • supertype – The AttributeType to set as the supertype of this AttributeType
§Examples
attribute_type.set_supertype(transaction, supertype).await;
source

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

Retrieves all supertypes of this AttributeType.

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

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

Retrieves all direct and indirect (or direct only) subtypes of this AttributeType.

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

fn get_subtypes_with_value_type<'tx>( &self, transaction: &'tx Transaction<'_>, value_type: ValueType, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<AttributeType>>>

Retrieves all direct and indirect (or direct only) subtypes of this AttributeType with given ValueType.

§Arguments
  • transaction – The current transaction
  • value_typeValueType for retrieving subtypes
  • transitivityTransitivity::Transitive for direct and indirect subtypes, Transitivity::Explicit for direct subtypes only
§Examples
attribute_type.get_subtypes_with_value_type(transaction, value_type, transitivity)
source

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

Retrieves all direct and indirect (or direct only) Attributes that are instances of this AttributeType.

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

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

Retrieves the regular expression that is defined for this AttributeType.

§Arguments
  • transaction – The current transaction
§Examples
attribute_type.get_regex(transaction).await;
source

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

Sets a regular expression as a constraint for this AttributeType. Values of all Attributes of this type (inserted earlier or later) should match this regex.

Can only be applied for AttributeTypes with a string value type.

§Arguments
  • transaction – The current transaction
  • regex – Regular expression
§Examples
attribute_type.set_regex(transaction, regex).await;
source

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

Removes the regular expression that is defined for this AttributeType.

§Arguments
  • transaction – The current transaction
§Examples
attribute_type.unset_regex(transaction).await;
source

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

Retrieve all Things that own an attribute of this AttributeType and have all given Annotations.

§Arguments
  • transaction – The current transaction
  • transitivityTransitivity::Transitive for direct and inherited ownership, Transitivity::Explicit for direct ownership only
  • annotations – Only retrieve ThingTypes that have an attribute of this AttributeType with all given Annotations
§Examples
attribute_type.get_owners(transaction, transitivity, annotations)

Object Safety§

This trait is not object safe.

Implementors§