reactive_graph_reactive_service_api/property/property_bool/
creator.rs

1use crate::TypedReactivePropertyCreator;
2use crate::TypedReactivePropertyImpl;
3use reactive_graph_graph::Mutability;
4use reactive_graph_reactive_model_api::ReactiveInstance;
5use serde_json::Value::Bool;
6
7impl<IdType, ReactiveInstanceType> TypedReactivePropertyCreator<IdType, ReactiveInstanceType> for TypedReactivePropertyImpl<IdType, ReactiveInstanceType, bool>
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, Bool(false));
17        }
18    }
19}