pub struct RuleEngine { /* private fields */ }Expand description
A flexible rule engine for type classification
Implementations§
Source§impl RuleEngine
impl RuleEngine
Sourcepub fn add_rule(
&mut self,
rule: Rule,
metadata: Option<RuleMetadata>,
) -> Result<(), RuleEngineError>
pub fn add_rule( &mut self, rule: Rule, metadata: Option<RuleMetadata>, ) -> Result<(), RuleEngineError>
Add a rule to the engine
Sourcepub fn remove_rule(&mut self, rule_id: &str) -> bool
pub fn remove_rule(&mut self, rule_id: &str) -> bool
Remove a rule by ID
Sourcepub fn set_rule_enabled(&mut self, rule_id: &str, enabled: bool) -> bool
pub fn set_rule_enabled(&mut self, rule_id: &str, enabled: bool) -> bool
Enable or disable a rule
Sourcepub fn find_matches(&self, type_name: &str) -> Vec<MatchResult>
pub fn find_matches(&self, type_name: &str) -> Vec<MatchResult>
Get all matching rules for a type name
Sourcepub fn classify(&self, type_name: &str) -> Option<TypeCategory>
pub fn classify(&self, type_name: &str) -> Option<TypeCategory>
Get the best match for a type name
Sourcepub fn get_stats(&self) -> RuleEngineStats
pub fn get_stats(&self) -> RuleEngineStats
Get statistics about the rule engine
Sourcepub fn get_rule_ids(&self) -> Vec<String>
pub fn get_rule_ids(&self) -> Vec<String>
Get all rule IDs
Sourcepub fn get_metadata(&self, rule_id: &str) -> Option<&RuleMetadata>
pub fn get_metadata(&self, rule_id: &str) -> Option<&RuleMetadata>
Get rule metadata
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleEngine
impl RefUnwindSafe for RuleEngine
impl Send for RuleEngine
impl Sync for RuleEngine
impl Unpin for RuleEngine
impl UnwindSafe for RuleEngine
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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