pub struct RuleTemplate {
pub name: String,
pub description: Option<String>,
pub parameters: Vec<ParameterDef>,
pub condition_template: String,
pub action_template: String,
pub salience: Option<i32>,
}Expand description
Rule template that can generate multiple rules with different parameters
Fields§
§name: StringTemplate name
description: Option<String>Template description
parameters: Vec<ParameterDef>List of parameters this template accepts
condition_template: StringCondition template with parameter placeholders
action_template: StringAction template with parameter placeholders
salience: Option<i32>Rule salience/priority
Implementations§
Source§impl RuleTemplate
impl RuleTemplate
Sourcepub fn with_parameter(self, name: &str, param_type: ParameterType) -> Self
pub fn with_parameter(self, name: &str, param_type: ParameterType) -> Self
Add a parameter to the template
Sourcepub fn with_condition(self, condition: &str) -> Self
pub fn with_condition(self, condition: &str) -> Self
Set the condition template
Sourcepub fn with_action(self, action: &str) -> Self
pub fn with_action(self, action: &str) -> Self
Set the action template
Sourcepub fn with_salience(self, salience: i32) -> Self
pub fn with_salience(self, salience: i32) -> Self
Set the salience for generated rules
Sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
Set description
Sourcepub fn instantiate(&self, rule_name: &str) -> TemplateInstance
pub fn instantiate(&self, rule_name: &str) -> TemplateInstance
Create a template instance for generating a specific rule
Trait Implementations§
Source§impl Clone for RuleTemplate
impl Clone for RuleTemplate
Source§fn clone(&self) -> RuleTemplate
fn clone(&self) -> RuleTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuleTemplate
impl Debug for RuleTemplate
Source§impl<'de> Deserialize<'de> for RuleTemplate
impl<'de> Deserialize<'de> for RuleTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RuleTemplate
impl RefUnwindSafe for RuleTemplate
impl Send for RuleTemplate
impl Sync for RuleTemplate
impl Unpin for RuleTemplate
impl UnwindSafe for RuleTemplate
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