pub struct DataEntity {
pub id: String,
pub type_: DataType,
pub dynamic_entity: Option<HashMap<String, EntityValue>>,
}Expand description
Represents a data entity with an identifier, type, and dynamic properties.
DataEntity is designed to encapsulate an entity with a unique identifier (id),
a specific type (type_), and a set of dynamic properties (dynamic_entity).
This struct is used to handle Data entities that have a predefined structure along with
additional properties that may vary.
Fields§
§id: StringURI to data
type_: DataTypeDefined type, if file MUST be type ‘File’
dynamic_entity: Option<HashMap<String, EntityValue>>Additional metadata
Implementations§
Source§impl DataEntity
impl DataEntity
Sourcepub fn get_property_value(
&self,
property: &str,
) -> Option<(String, EntityValue)>
pub fn get_property_value( &self, property: &str, ) -> Option<(String, EntityValue)>
Gets ID and value of specific target property
Sourcepub fn find_value_details(
&self,
target_value: &EntityValue,
) -> Option<(String, String)>
pub fn find_value_details( &self, target_value: &EntityValue, ) -> Option<(String, String)>
pub fn get_linked_ids(&self) -> Vec<Id>
Trait Implementations§
Source§impl Clone for DataEntity
impl Clone for DataEntity
Source§fn clone(&self) -> DataEntity
fn clone(&self) -> DataEntity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CustomSerialize for DataEntity
Provides custom serialization for DataEntity.
impl CustomSerialize for DataEntity
Provides custom serialization for DataEntity.
Implements custom serialization logic as defined in the CustomSerialize trait.
This allows DataEntity to be serialized with custom rules, especially for the
dynamic properties in the dynamic_entity field.
Source§impl Debug for DataEntity
impl Debug for DataEntity
Source§impl<'de> Deserialize<'de> for DataEntity
Custom deserialization implementation for DataEntity.
impl<'de> Deserialize<'de> for DataEntity
Custom deserialization implementation for DataEntity.
This method provides a tailored approach to convert serialized data
(like JSON) into a DataEntity instance. It employs a DataEntityVisitor
for map-based deserialization.
The method expects the serialized data to be in a map format (key-value pairs),
which is typical for formats like JSON. It specifically looks for @id and @type
keys to fill the corresponding fields of DataEntity. All other keys are treated
as dynamic properties and are stored in a HashMap.
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 DataEntity
Custom display formatting for DataEntity
impl Display for DataEntity
Custom display formatting for DataEntity
Source§impl DynamicEntityManipulation for DataEntity
Provides functionality for manipulating dynamic properties of a DataEntity.
impl DynamicEntityManipulation for DataEntity
Provides functionality for manipulating dynamic properties of a DataEntity.
This trait implementation allows for adding, modifying, and removing dynamic properties
stored in the dynamic_entity field of DataEntity.
Source§fn dynamic_entity(&mut self) -> &mut Option<HashMap<String, EntityValue>>
fn dynamic_entity(&mut self) -> &mut Option<HashMap<String, EntityValue>>
Source§fn dynamic_entity_immut(&self) -> &Option<HashMap<String, EntityValue>>
fn dynamic_entity_immut(&self) -> &Option<HashMap<String, EntityValue>>
Source§fn add_dynamic_fields(&mut self, values: HashMap<String, EntityValue>)
fn add_dynamic_fields(&mut self, values: HashMap<String, EntityValue>)
Source§fn add_string_value(&mut self, key: String, value: String)
fn add_string_value(&mut self, key: String, value: String)
Source§fn add_id_value(&mut self, key: String, value: Id)
fn add_id_value(&mut self, key: String, value: Id)
Source§fn remove_field(&mut self, key: &str)
fn remove_field(&mut self, key: &str)
Source§fn search_value(&self, search_value: &EntityValue) -> bool
fn search_value(&self, search_value: &EntityValue) -> bool
Source§fn search_properties_for_value(
&self,
search_property: &str,
) -> Option<EntityValue>
fn search_properties_for_value( &self, search_property: &str, ) -> Option<EntityValue>
Source§fn get_all_keys(&self) -> Vec<String>
fn get_all_keys(&self) -> Vec<String>
Source§fn remove_matching_value(&mut self, target_id: &str)
fn remove_matching_value(&mut self, target_id: &str)
Source§impl Serialize for DataEntity
Custom serde serialization implementation for DataEntity.
impl Serialize for DataEntity
Custom serde serialization implementation for DataEntity.
Delegates the serialization process to the custom_serialize method
provided by the CustomSerialize trait implementation.
Auto Trait Implementations§
impl Freeze for DataEntity
impl RefUnwindSafe for DataEntity
impl Send for DataEntity
impl Sync for DataEntity
impl Unpin for DataEntity
impl UnsafeUnpin for DataEntity
impl UnwindSafe for DataEntity
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.