assert_in_range_as_result

Macro assert_in_range_as_result 

Source
macro_rules! assert_in_range_as_result {
    ($a:expr, $range:expr $(,)?) => { ... };
}
Expand description

Assert an item is in a range.

Pseudocode:
a is in range

  • 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