reactive_graph_reactive_service_api/property/property_f64/
creator.rs1use crate::TypedReactivePropertyCreator;
2use crate::TypedReactivePropertyImpl;
3use reactive_graph_graph::Mutability;
4use reactive_graph_reactive_model_api::ReactiveInstance;
5use serde_json::json;
6
7impl<IdType, ReactiveInstanceType> TypedReactivePropertyCreator<IdType, ReactiveInstanceType> for TypedReactivePropertyImpl<IdType, ReactiveInstanceType, f64>
8where
9 IdType: Clone,
10 ReactiveInstanceType: ReactiveInstance<IdType>,
11{
12 type Target = String;
13
14 fn create(&self) {
15 if !self.reactive_instance.has_property(&self.property_name) {
16 self.reactive_instance.add_property(&self.property_name, Mutability::Mutable, json!(0f64));
17 }
18 }
19}