Module module

Module module 

Source
Expand description

Module system for namespace isolation (CLIPS-inspired defmodule) Module System (CLIPS-inspired defmodule)

Provides namespace isolation and visibility control for large knowledge bases. Similar to CLIPS defmodule, Drools rule units, and package systems.

§Features

  • Module Isolation: Separate namespaces for rules, templates, and facts
  • Import/Export Control: Fine-grained visibility management
  • Module Focus: Control execution flow across modules
  • Pattern Matching: Export/import with wildcards (e.g., “sensor-*”)

§Example

use rust_rule_engine::engine::module::{ModuleManager, ExportList, ImportType};

let mut manager = ModuleManager::new();

// Create modules
manager.create_module("SENSORS").unwrap();
manager.create_module("CONTROL").unwrap();

// Configure exports
manager.export_all_from("SENSORS", ExportList::All).unwrap();

// Configure imports
manager.import_from("CONTROL", "SENSORS", ImportType::AllTemplates, "*").unwrap();

// Set focus
manager.set_focus("CONTROL").unwrap();

Structs§

ExportItem
Single export item
ImportDecl
Import declaration
Module
A module in the knowledge base
ModuleInfo
Information about a single module
ModuleManager
Module manager for organizing knowledge bases
ModuleStats
Module statistics

Enums§

ExportList
Export list specification
ImportType
Import type specification
ItemType
Type of item that can be exported/imported