pub struct Rule {
pub name: String,
pub description: Option<String>,
pub salience: i32,
pub when_condition: Expression,
pub then_actions: Vec<Expression>,
}Expand description
A rule: when its condition holds, its actions run.
Fields§
§name: StringUnique name, used by Retract and in errors.
description: Option<String>Optional description.
salience: i32Priority: when several rules match, the highest salience fires first.
when_condition: ExpressionThe condition, which must evaluate to a boolean.
then_actions: Vec<Expression>The actions: assignments and function or method calls.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn new(
name: String,
salience: i32,
when_condition: Expression,
then_actions: Vec<Expression>,
) -> Self
pub fn new( name: String, salience: i32, when_condition: Expression, then_actions: Vec<Expression>, ) -> Self
A rule with no description.
Sourcepub fn with_description(self, description: String) -> Self
pub fn with_description(self, description: String) -> Self
Sets the description.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
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
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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