pub struct RuleEngine { /* private fields */ }Expand description
规则引擎
Implementations§
Source§impl RuleEngine
impl RuleEngine
Sourcepub fn new(string_pool: Arc<StringPool>) -> Self
pub fn new(string_pool: Arc<StringPool>) -> Self
创建新的规则引擎
Sourcepub fn remove_rule(&self, rule_id: &str) -> Result<()>
pub fn remove_rule(&self, rule_id: &str) -> Result<()>
删除规则
Sourcepub fn execute_rule(
&self,
rule_id: &str,
context: &RuleContext,
) -> Result<RuleResult>
pub fn execute_rule( &self, rule_id: &str, context: &RuleContext, ) -> Result<RuleResult>
执行规则
Sourcepub fn register_custom_handler(&self, handler: Arc<dyn CustomRuleHandler>)
pub fn register_custom_handler(&self, handler: Arc<dyn CustomRuleHandler>)
注册自定义规则处理器
Sourcepub fn get_all_rules(&self) -> Vec<Rule>
pub fn get_all_rules(&self) -> Vec<Rule>
获取所有规则
Sourcepub fn find_rules_by_tag(&self, tag: &str) -> Vec<Rule>
pub fn find_rules_by_tag(&self, tag: &str) -> Vec<Rule>
根据标签查找规则
Sourcepub fn get_inheritance_chain(&self, rule_id: &str) -> Vec<String>
pub fn get_inheritance_chain(&self, rule_id: &str) -> Vec<String>
获取规则继承链
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
清理缓存
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