Skip to main content

EdifactValidator

Struct EdifactValidator 

Source
pub struct EdifactValidator<E: ConditionEvaluator> { /* private fields */ }
Expand description

Validates EDIFACT messages against AHB business rules.

The validator is a pure validation engine: it receives pre-parsed segments, an AHB workflow, and an external condition provider. Parsing and message-type detection are the caller’s responsibility.

The validator is generic over the ConditionEvaluator implementation, which is typically generated from AHB XML schemas.

§Example

use automapper_validation::validator::EdifactValidator;
use automapper_validation::eval::NoOpExternalProvider;

let evaluator = UtilmdConditionEvaluatorFV2510::new();
let validator = EdifactValidator::new(evaluator);
let external = NoOpExternalProvider;

let report = validator.validate(
    &segments,
    &ahb_workflow,
    &external,
    ValidationLevel::Full,
);

if !report.is_valid() {
    for error in report.errors() {
        eprintln!("{error}");
    }
}

Implementations§

Source§

impl<E: ConditionEvaluator> EdifactValidator<E>

Source

pub fn new(evaluator: E) -> Self

Create a new validator with the given condition evaluator.

Source

pub fn validate( &self, segments: &[OwnedSegment], workflow: &AhbWorkflow, external: &dyn ExternalConditionProvider, level: ValidationLevel, ) -> ValidationReport

Validate pre-parsed EDIFACT segments against an AHB workflow.

§Arguments
  • segments - Pre-parsed EDIFACT segments
  • workflow - AHB workflow definition for the PID
  • external - Provider for external conditions
  • level - Validation strictness level
§Returns

A ValidationReport with all issues found.

Source

pub fn validate_with_navigator( &self, segments: &[OwnedSegment], workflow: &AhbWorkflow, external: &dyn ExternalConditionProvider, level: ValidationLevel, navigator: &dyn GroupNavigator, ) -> ValidationReport

Validate with a group navigator for group-scoped condition queries.

Same as [validate] but passes a GroupNavigator to the EvaluationContext, enabling conditions to query segments within specific group instances (e.g., “in derselben SG8”).

Auto Trait Implementations§

§

impl<E> Freeze for EdifactValidator<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for EdifactValidator<E>
where E: RefUnwindSafe,

§

impl<E> Send for EdifactValidator<E>

§

impl<E> Sync for EdifactValidator<E>

§

impl<E> Unpin for EdifactValidator<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for EdifactValidator<E>
where E: UnsafeUnpin,

§

impl<E> UnwindSafe for EdifactValidator<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.