Skip to main content

Module error

Module error 

Source
Expand description

Error types for thing-matcher operations.

The crate uses a single sum-type, MatchingError, for every fallible operation, and a Result alias to keep call-sites concise.

The matching engine itself is infallible: scoring two things always produces a crate::MatchResult. Errors arise from explicit validation steps such as crate::Thing::validate.

§Example

use thing_matcher::{MatchingError, Thing};

let empty = Thing::builder().build();
match empty.validate() {
    Err(MatchingError::MissingField(msg)) => {
        assert!(msg.contains("required"));
    }
    other => panic!("unexpected: {other:?}"),
}

Enums§

MatchingError
Errors that may be returned by thing-matcher operations.

Type Aliases§

Result
Result alias used throughout the crate.