assert_is_match_as_result

Macro assert_is_match_as_result 

Source
macro_rules! assert_is_match_as_result {
    ($matcher:expr, $matchee:expr $(,)?) => { ... };
}
Expand description

Assert an expression (such as a regex) is a match for an expression (such as a string).

Pseudocode:
a.is_match(b)

  • If true, return Result Ok(()).

  • Otherwise, return Result Err(message).

This macro is useful for runtime checks, such as checking parameters, or sanitizing inputs, or handling different results in different ways.

ยงModule macros