Struct RelationInstance

Source
pub struct RelationInstance {
    pub outbound_id: Uuid,
    pub ty: RelationInstanceTypeId,
    pub inbound_id: Uuid,
    pub name: String,
    pub description: String,
    pub properties: PropertyInstances,
    pub components: ComponentTypeIds,
    pub extensions: Extensions,
}
Expand description

Relation instances are edges from an outbound entity instance to an inbound entity instance.

The relation instance is of a relation type. The relation type defines the entity types of the outbound entity instance and the inbound entity instance. Furthermore, the relation type defines which properties (name, data type, socket type) a relation instance have to have.

In contrast to the relation type, the relation instance stores values/ documents in its properties.

Fields§

§outbound_id: Uuid

The id of the outbound vertex.

§ty: RelationInstanceTypeId

The relation instance id is unique and consists of the relation type and an instance_id.

§inbound_id: Uuid

The id of the inbound vertex.

§name: String

The name of the relation instance.

§description: String

Textual description of the relation instance.

§properties: PropertyInstances

The properties of then relation instance.

Each property is represented by its name (String) and it’s value. The value is a representation of a JSON. Therefore, the value can be boolean, number, string, array or an object. For more information about the data types please look at https://docs.serde.rs/serde_json/value/enum.Value.html

§components: ComponentTypeIds

The components of the entity instance.

§extensions: Extensions

Relation instance specific extensions.

Implementations§

Source§

impl RelationInstance

Source

pub fn builder() -> RelationInstanceBuilder<((), (), (), (), (), (), (), ())>

Create a builder for building RelationInstance. On the builder, call .outbound_id(...), .ty(...), .inbound_id(...), .name(...)(optional), .description(...)(optional), .properties(...)(optional), .components(...)(optional), .extensions(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of RelationInstance.

Source§

impl RelationInstance

Source

pub fn new<T: Into<RelationInstanceTypeId>, P: Into<PropertyInstances>>( outbound_id: Uuid, ty: T, inbound_id: Uuid, properties: P, ) -> RelationInstance

Constructs a new relation instance with the given outbound_id, type, inbound_id and properties

Source

pub fn new_from_type_unique_id<S: Into<String>, P: Into<PropertyInstances>>( namespace: S, outbound_id: Uuid, type_name: S, inbound_id: Uuid, properties: P, ) -> RelationInstance

Constructs a new relation instance with the given outbound_id, type, inbound_id and properties

Source

pub fn new_from_type_unique_for_instance_id<S: Into<String>, P: Into<PropertyInstances>>( namespace: S, outbound_id: Uuid, type_name: S, instance_id: S, inbound_id: Uuid, properties: P, ) -> RelationInstance

Constructs a new relation instance with the given outbound_id, type, inbound_id and properties

Source

pub fn new_from_type_with_random_instance_id<S: Into<String>, P: Into<PropertyInstances>>( namespace: S, outbound_id: Uuid, type_name: S, inbound_id: Uuid, properties: P, ) -> RelationInstance

Constructs a new relation instance with the given outbound_id, type, inbound_id and properties

Source

pub fn new_without_properties<T: Into<RelationInstanceTypeId>>( outbound_id: Uuid, ty: T, inbound_id: Uuid, ) -> RelationInstance

Constructs a new relation instance with the given outbound_id, type, inbound_id but without properties

Source

pub fn id(&self) -> RelationInstanceId

Returns the relation instance id.

Source

pub fn relation_type_id(&self) -> RelationTypeId

Returns the inner relation type id.

Source

pub fn instance_id(&self) -> String

Returns the relation instance type id.

Trait Implementations§

Source§

impl Clone for RelationInstance

Source§

fn clone(&self) -> RelationInstance

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComponentTypeIdContainer for RelationInstance

Source§

fn is_a(&self, ty: &ComponentTypeId) -> bool

Returns true, if the type is composed with a component of the given type.
Source§

fn add_component<C: Into<ComponentTypeId>>(&self, ty: C) -> bool

Adds the given component.
Source§

fn add_components<C: Into<ComponentTypeIds>>(&mut self, components_to_add: C)

Adds the given components.
Source§

fn remove_component(&self, ty: &ComponentTypeId) -> Option<ComponentTypeId>

Removes the component with the given type id.
Source§

fn remove_components<C: Into<ComponentTypeIds>>( &mut self, components_to_remove: C, )

Removes the given components.
Source§

fn is_any(&self, component_tys: &ComponentTypeIds) -> bool

Returns true, if the type is composed with any of the given components.
Source§

fn is_all(&self, component_tys: &ComponentTypeIds) -> bool

Returns true, if the type is composed with every given components.
Source§

impl Debug for RelationInstance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RelationInstance

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for RelationInstance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExtensionContainer for RelationInstance

Source§

fn has_own_extension(&self, ty: &ExtensionTypeId) -> bool

Returns true, if the container has an extension with the given type.
Source§

fn get_own_extension(&self, ty: &ExtensionTypeId) -> Option<Extension>

Returns the own extension with the given type. Doesn’t respect extensions from potential components.
Source§

fn add_extension<E: Into<Extension>>( &self, extension: E, ) -> Result<ExtensionTypeId, AddExtensionError>

Source§

fn update_extension<T: Into<ExtensionTypeId>, E: Into<Extension>>( &self, ty: T, extension: E, ) -> Result<Extension, UpdateExtensionError>

Source§

fn remove_extension<T: Into<ExtensionTypeId>>( &self, ty: T, ) -> Result<Extension, RemoveExtensionError>

Source§

fn merge_extensions<E: Into<Extensions>>(&mut self, extensions_to_merge: E)

Merge the given extensions into the own extensions.
Source§

fn has_any_own_extensions(&self, tys: &ExtensionTypeIds) -> bool

Returns true, if the type contains any of the given extensions.
Source§

fn has_all_own_extensions(&self, tys: &ExtensionTypeIds) -> bool

Returns true, if the type contains all given extensions.
Source§

impl FromIterator<RelationInstance> for RelationInstances

Source§

fn from_iter<I: IntoIterator<Item = RelationInstance>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for RelationInstance

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl JsonSchema for RelationInstance

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
§

fn always_inline_schema() -> bool

👎Deprecated: Use inline_schema() instead
Only included for backward-compatibility - use inline_schema() instead“. Read more
Source§

impl MutablePropertyInstanceSetter for RelationInstance

Source§

fn set<S: Into<String>>(&mut self, property_name: S, value: Value)

Sets the value of the given property by name
Source§

impl NamedInstanceContainer for RelationInstance

Source§

fn name(&self) -> String

Returns the name of the instance.
Source§

fn description(&self) -> String

Returns the description of the instance.
Source§

impl NamespacedTypeGetter for RelationInstance

Source§

fn namespace(&self) -> String

Returns the namespace of the type.
Source§

fn type_name(&self) -> String

Returns the name of the type.
Source§

impl Ord for RelationInstance

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<RelationInstanceId> for RelationInstance

Source§

fn eq(&self, id: &RelationInstanceId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for RelationInstance

Source§

fn eq(&self, other: &RelationInstance) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for RelationInstance

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PropertyInstanceGetter for RelationInstance

Source§

fn get<S: Into<String>>(&self, property_name: S) -> Option<Value>

Returns the json value of the given property by name
Source§

fn as_bool<S: Into<String>>(&self, property_name: S) -> Option<bool>

Returns the boolean value of the given property by name
Source§

fn as_u64<S: Into<String>>(&self, property_name: S) -> Option<u64>

Returns the u64 value of the given property by name
Source§

fn as_i64<S: Into<String>>(&self, property_name: S) -> Option<i64>

Returns the i64 value of the given property by name
Source§

fn as_f64<S: Into<String>>(&self, property_name: S) -> Option<f64>

Returns the f64 value of the given property by name
Source§

fn as_string<S: Into<String>>(&self, property_name: S) -> Option<String>

Returns the string value of the given property by name
Source§

fn as_array<S: Into<String>>(&self, property_name: S) -> Option<Vec<Value>>

Returns the string value of the given property by name
Source§

fn as_object<S: Into<String>>( &self, property_name: S, ) -> Option<Map<String, Value>>

Returns the string value of the given property by name
Source§

impl Serialize for RelationInstance

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TypeDefinitionGetter for RelationInstance

Source§

fn type_definition(&self) -> TypeDefinition

Returns the type definition of the type.
Source§

impl Eq for RelationInstance

Source§

impl StructuralPartialEq for RelationInstance

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> JsonSchemaIdGetter for T

Source§

fn json_schema_id(&self) -> JsonSchemaId

Returns the JSON Schema identifier ($id).
Source§

fn json_schema_id_property(&self) -> Value

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,