pub trait ConditionEvaluator: Send + Sync {
// Required methods
fn evaluate(
&self,
condition: u32,
ctx: &EvaluationContext<'_>,
) -> ConditionResult;
fn is_external(&self, condition: u32) -> bool;
fn message_type(&self) -> &str;
fn format_version(&self) -> &str;
// Provided method
fn is_known(&self, _condition: u32) -> bool { ... }
}Expand description
Evaluates individual AHB conditions by number.
Implementations are typically generated from AHB XML schemas (one per message type and format version). Each condition number maps to a specific business rule check.
Required Methods§
Sourcefn evaluate(
&self,
condition: u32,
ctx: &EvaluationContext<'_>,
) -> ConditionResult
fn evaluate( &self, condition: u32, ctx: &EvaluationContext<'_>, ) -> ConditionResult
Evaluate a single condition by number.
Returns ConditionResult::Unknown for unrecognized condition numbers
or conditions that require unavailable external context.
Sourcefn is_external(&self, condition: u32) -> bool
fn is_external(&self, condition: u32) -> bool
Returns true if the given condition requires external context
(i.e., cannot be determined from the EDIFACT message alone).
Sourcefn message_type(&self) -> &str
fn message_type(&self) -> &str
Returns the message type this evaluator handles (e.g., “UTILMD”).
Sourcefn format_version(&self) -> &str
fn format_version(&self) -> &str
Returns the format version this evaluator handles (e.g., “FV2510”).
Provided Methods§
Sourcefn is_known(&self, _condition: u32) -> bool
fn is_known(&self, _condition: u32) -> bool
Returns true if this evaluator has an implementation for the given
condition number (whether internal or external). Conditions that fall
through to the _ => Unknown wildcard return false.
This allows distinguishing “implemented but returned Unknown because the relevant data isn’t present in the message” from “not implemented at all”.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".