reactive_graph_std_logical/behaviour/entity/operation/
function.rs1use std::sync::Arc;
2use std::sync::LazyLock;
3
4use reactive_graph_behaviour_model_impl::entity::EntityBehaviourFactoryCreator;
5use reactive_graph_behaviour_model_impl::entity::EntityBehaviourFunctions;
6use reactive_graph_behaviour_model_impl::entity::EntityBehaviourFunctionsStorage;
7
8use crate::behaviour::entity::operation::LogicalOperationFactory;
9use reactive_graph_std_logical_model::NAMESPACE_LOGICAL;
10
11pub type LogicalOperationFunction = fn(bool) -> bool;
12
13pub const FN_NOT: LogicalOperationFunction = |lhs| !lhs;
14
15const FACTORY_CREATOR: EntityBehaviourFactoryCreator<LogicalOperationFunction> = |ty, f| Arc::new(LogicalOperationFactory::new(ty.clone(), f));
16
17pub static LOGICAL_OPERATIONS: EntityBehaviourFunctionsStorage<LogicalOperationFunction> = LazyLock::new(|| {
18 EntityBehaviourFunctions::<LogicalOperationFunction>::with_namespace(NAMESPACE_LOGICAL, FACTORY_CREATOR)
19 .behaviour("not", FN_NOT)
20 .get()
21});