pub struct Module {
pub name: String,
pub doc: Option<String>,
/* private fields */
}Expand description
A module in the knowledge base
Fields§
§name: StringModule name
doc: Option<String>Module documentation
Implementations§
Source§impl Module
impl Module
Sourcepub fn add_template(&mut self, template_name: impl Into<String>)
pub fn add_template(&mut self, template_name: impl Into<String>)
Add a template to this module
Sourcepub fn add_fact_type(&mut self, fact_type: impl Into<String>)
pub fn add_fact_type(&mut self, fact_type: impl Into<String>)
Add a fact type to this module
Sourcepub fn set_exports(&mut self, exports: ExportList)
pub fn set_exports(&mut self, exports: ExportList)
Set export specification
Sourcepub fn get_exports(&self) -> &ExportList
pub fn get_exports(&self) -> &ExportList
Get export specification
Sourcepub fn add_import(&mut self, import: ImportDecl)
pub fn add_import(&mut self, import: ImportDecl)
Add an import declaration
Sourcepub fn exports_rule(&self, rule_name: &str) -> bool
pub fn exports_rule(&self, rule_name: &str) -> bool
Check if this module exports a rule (including re-exports)
Sourcepub fn exports_template(&self, template_name: &str) -> bool
pub fn exports_template(&self, template_name: &str) -> bool
Check if this module exports a template (including re-exports)
Sourcepub fn get_templates(&self) -> &HashSet<String>
pub fn get_templates(&self) -> &HashSet<String>
Get all templates in this module
Sourcepub fn get_imports(&self) -> &[ImportDecl]
pub fn get_imports(&self) -> &[ImportDecl]
Get all imports
Sourcepub fn set_salience(&mut self, salience: i32)
pub fn set_salience(&mut self, salience: i32)
Set module-level salience (priority adjustment for all rules)
Sourcepub fn get_salience(&self) -> i32
pub fn get_salience(&self) -> i32
Get module-level salience
Sourcepub fn should_re_export_rule(&self, rule_name: &str) -> bool
pub fn should_re_export_rule(&self, rule_name: &str) -> bool
Check if a rule should be re-exported based on import declarations
Sourcepub fn should_re_export_template(&self, template_name: &str) -> bool
pub fn should_re_export_template(&self, template_name: &str) -> bool
Check if a template should be re-exported based on import declarations
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more