pub struct EntityInstance {
pub ty: EntityTypeId,
pub id: Uuid,
pub name: String,
pub description: String,
pub properties: PropertyInstances,
pub components: ComponentTypeIds,
pub extensions: Extensions,
}
Expand description
Entity instances represents an typed object which contains properties.
The entity type defines the properties (name, data type and socket type).
In contrast to the entity type the entity instance stores values in its properties.
Fields§
§ty: EntityTypeId
The type definition of the entity type.
id: Uuid
The unique identifier of the entity instance.
name: String
The name of the entity instance.
description: String
The description of the entity instance.
properties: PropertyInstances
The properties of the entity 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
Entity instance specific extensions.
Implementations§
Source§impl EntityInstance
impl EntityInstance
Sourcepub fn builder() -> EntityInstanceBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> EntityInstanceBuilder<((), (), (), (), (), (), ())>
Create a builder for building EntityInstance
.
On the builder, call .ty(...)
, .id(...)
(optional), .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 EntityInstance
.
Source§impl EntityInstance
impl EntityInstance
Sourcepub fn new<T: Into<EntityTypeId>, P: Into<PropertyInstances>>(
ty: T,
id: Uuid,
properties: P,
) -> EntityInstance
pub fn new<T: Into<EntityTypeId>, P: Into<PropertyInstances>>( ty: T, id: Uuid, properties: P, ) -> EntityInstance
Constructs a new entity instance with the given type.
Sourcepub fn new_from_type<N: Into<String>, T: Into<String>, P: Into<PropertyInstances>>(
namespace: N,
type_name: T,
id: Uuid,
properties: P,
) -> EntityInstance
pub fn new_from_type<N: Into<String>, T: Into<String>, P: Into<PropertyInstances>>( namespace: N, type_name: T, id: Uuid, properties: P, ) -> EntityInstance
Constructs a new entity instance with the given namespace, type_name, id and properties.
Sourcepub fn new_without_properties<T: Into<EntityTypeId>>(
ty: T,
id: Uuid,
) -> EntityInstance
pub fn new_without_properties<T: Into<EntityTypeId>>( ty: T, id: Uuid, ) -> EntityInstance
Constructs a new entity instance with the given type and id but without properties.
Trait Implementations§
Source§impl Clone for EntityInstance
impl Clone for EntityInstance
Source§fn clone(&self) -> EntityInstance
fn clone(&self) -> EntityInstance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl ComponentTypeIdContainer for EntityInstance
impl ComponentTypeIdContainer for EntityInstance
Source§fn is_a(&self, ty: &ComponentTypeId) -> bool
fn is_a(&self, ty: &ComponentTypeId) -> bool
Source§fn add_component<C: Into<ComponentTypeId>>(&self, ty: C) -> bool
fn add_component<C: Into<ComponentTypeId>>(&self, ty: C) -> bool
Source§fn add_components<C: Into<ComponentTypeIds>>(&mut self, components_to_add: C)
fn add_components<C: Into<ComponentTypeIds>>(&mut self, components_to_add: C)
Source§fn remove_component(&self, ty: &ComponentTypeId) -> Option<ComponentTypeId>
fn remove_component(&self, ty: &ComponentTypeId) -> Option<ComponentTypeId>
Source§fn remove_components<C: Into<ComponentTypeIds>>(
&mut self,
components_to_remove: C,
)
fn remove_components<C: Into<ComponentTypeIds>>( &mut self, components_to_remove: C, )
Source§fn is_any(&self, component_tys: &ComponentTypeIds) -> bool
fn is_any(&self, component_tys: &ComponentTypeIds) -> bool
Source§fn is_all(&self, component_tys: &ComponentTypeIds) -> bool
fn is_all(&self, component_tys: &ComponentTypeIds) -> bool
Source§impl Debug for EntityInstance
impl Debug for EntityInstance
Source§impl<'de> Deserialize<'de> for EntityInstance
impl<'de> Deserialize<'de> for EntityInstance
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for EntityInstance
impl Display for EntityInstance
Source§impl ExtensionContainer for EntityInstance
impl ExtensionContainer for EntityInstance
Source§fn has_own_extension(&self, ty: &ExtensionTypeId) -> bool
fn has_own_extension(&self, ty: &ExtensionTypeId) -> bool
Source§fn get_own_extension(&self, ty: &ExtensionTypeId) -> Option<Extension>
fn get_own_extension(&self, ty: &ExtensionTypeId) -> Option<Extension>
fn add_extension<E: Into<Extension>>( &self, extension: E, ) -> Result<ExtensionTypeId, AddExtensionError>
fn update_extension<T: Into<ExtensionTypeId>, E: Into<Extension>>( &self, ty: T, extension: E, ) -> Result<Extension, UpdateExtensionError>
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)
fn merge_extensions<E: Into<Extensions>>(&mut self, extensions_to_merge: E)
Source§fn has_any_own_extensions(&self, tys: &ExtensionTypeIds) -> bool
fn has_any_own_extensions(&self, tys: &ExtensionTypeIds) -> bool
Source§fn has_all_own_extensions(&self, tys: &ExtensionTypeIds) -> bool
fn has_all_own_extensions(&self, tys: &ExtensionTypeIds) -> bool
Source§impl From<EntityInstance> for FlowInstance
impl From<EntityInstance> for FlowInstance
Source§fn from(wrapper_entity_instance: EntityInstance) -> FlowInstance
fn from(wrapper_entity_instance: EntityInstance) -> FlowInstance
Source§impl FromIterator<EntityInstance> for EntityInstances
impl FromIterator<EntityInstance> for EntityInstances
Source§fn from_iter<I: IntoIterator<Item = EntityInstance>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = EntityInstance>>(iter: I) -> Self
Source§impl Hash for EntityInstance
impl Hash for EntityInstance
Source§impl JsonSchema for EntityInstance
impl JsonSchema for EntityInstance
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref
keyword. Read more§fn always_inline_schema() -> bool
fn always_inline_schema() -> bool
inline_schema()
insteadinline_schema()
instead“. Read moreSource§impl Ord for EntityInstance
impl Ord for EntityInstance
Source§impl PartialEq<Uuid> for EntityInstance
impl PartialEq<Uuid> for EntityInstance
Source§impl PartialEq for EntityInstance
impl PartialEq for EntityInstance
Source§impl PartialOrd for EntityInstance
impl PartialOrd for EntityInstance
Source§impl PropertyInstanceGetter for EntityInstance
impl PropertyInstanceGetter for EntityInstance
Source§fn get<S: Into<String>>(&self, property_name: S) -> Option<Value>
fn get<S: Into<String>>(&self, property_name: S) -> Option<Value>
Source§fn as_bool<S: Into<String>>(&self, property_name: S) -> Option<bool>
fn as_bool<S: Into<String>>(&self, property_name: S) -> Option<bool>
Source§fn as_u64<S: Into<String>>(&self, property_name: S) -> Option<u64>
fn as_u64<S: Into<String>>(&self, property_name: S) -> Option<u64>
Source§fn as_i64<S: Into<String>>(&self, property_name: S) -> Option<i64>
fn as_i64<S: Into<String>>(&self, property_name: S) -> Option<i64>
Source§fn as_f64<S: Into<String>>(&self, property_name: S) -> Option<f64>
fn as_f64<S: Into<String>>(&self, property_name: S) -> Option<f64>
Source§fn as_string<S: Into<String>>(&self, property_name: S) -> Option<String>
fn as_string<S: Into<String>>(&self, property_name: S) -> Option<String>
Source§impl Serialize for EntityInstance
impl Serialize for EntityInstance
Source§impl TypeDefinitionGetter for EntityInstance
impl TypeDefinitionGetter for EntityInstance
Source§fn type_definition(&self) -> TypeDefinition
fn type_definition(&self) -> TypeDefinition
impl Eq for EntityInstance
impl StructuralPartialEq for EntityInstance
Auto Trait Implementations§
impl Freeze for EntityInstance
impl !RefUnwindSafe for EntityInstance
impl Send for EntityInstance
impl Sync for EntityInstance
impl Unpin for EntityInstance
impl UnwindSafe for EntityInstance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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