soft_debug_assert_matches

Macro soft_debug_assert_matches 

Source
macro_rules! soft_debug_assert_matches {
    ($e:expr, $p:pat) => { ... };
    ($e:expr, $p:pat,) => { ... };
    ($e:expr, $p:pat, $failed:expr) => { ... };
    ($e:expr, $p:pat, $failed:expr,) => { ... };
}
Expand description

Asserts a value matches a pattern, returning otherwise.

Non-panicking version of debug_assert_matches.

§Custom return values

Unless otherwise specified, this will return the default value of the return type (if it has one). A custom value can be returned instead by supplying it as an additional argument (similar to assert’s custom message), i.e. soft_debug_assert_match!(x, None, Err(e)). Ownership of any captured values is only taken if the assertion fails, so you can continue to use them later on.

This does not perform Err(..)-wrapping, to allow returning any value.