pub struct InferenceRule {
pub rule_id: String,
pub name: String,
pub description: String,
pub premises: Vec<LogicalConstraint>,
pub conclusions: Vec<String>,
pub combine_with: LogicalOperator,
pub priority: i32,
pub is_default_rule: bool,
}Expand description
A logical inference rule (if-then)
Fields§
§rule_id: StringUnique identifier
name: StringHuman-readable name
description: StringDescription
premises: Vec<LogicalConstraint>Premises (conditions that must be true)
conclusions: Vec<String>Conclusions (what becomes true if premises hold)
combine_with: LogicalOperatorLogical operator for combining premises
priority: i32Priority (higher = earlier evaluation)
is_default_rule: boolIs this a default rule?
Implementations§
Source§impl InferenceRule
impl InferenceRule
Sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
Set description
Sourcepub fn with_premise(self, constraint: LogicalConstraint) -> Self
pub fn with_premise(self, constraint: LogicalConstraint) -> Self
Add a premise constraint
Sourcepub fn with_conclusion(self, conclusion: &str) -> Self
pub fn with_conclusion(self, conclusion: &str) -> Self
Add a conclusion
Sourcepub fn with_operator(self, op: LogicalOperator) -> Self
pub fn with_operator(self, op: LogicalOperator) -> Self
Set logical operator for combining premises
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set priority
Sourcepub fn as_default(self) -> Self
pub fn as_default(self) -> Self
Mark as default rule
Trait Implementations§
Source§impl Clone for InferenceRule
impl Clone for InferenceRule
Source§fn clone(&self) -> InferenceRule
fn clone(&self) -> InferenceRule
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 InferenceRule
impl Debug for InferenceRule
Source§impl<'de> Deserialize<'de> for InferenceRule
impl<'de> Deserialize<'de> for InferenceRule
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 InferenceRule
impl RefUnwindSafe for InferenceRule
impl Send for InferenceRule
impl Sync for InferenceRule
impl Unpin for InferenceRule
impl UnwindSafe for InferenceRule
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> 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