reactive_graph_reactive_service_api/property/property_string/
creator.rs

1use crate::TypedReactivePropertyCreator;
2use crate::TypedReactivePropertyImpl;
3use reactive_graph_graph::DataType;
4use reactive_graph_graph::Mutability;
5use reactive_graph_reactive_model_api::ReactiveInstance;
6
7impl<IdType, ReactiveInstanceType> TypedReactivePropertyCreator<IdType, ReactiveInstanceType>
8    for TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>
9where
10    IdType: Clone,
11    ReactiveInstanceType: ReactiveInstance<IdType>,
12{
13    type Target = String;
14
15    fn create(&self) {
16        if !self.reactive_instance.has_property(&self.property_name) {
17            self.reactive_instance
18                .add_property(&self.property_name, Mutability::Mutable, DataType::String.default_value());
19        }
20    }
21}