Skip to main content

assert

Macro assert 

Source
macro_rules! assert {
    ($condition:expr $(,)?) => { ... };
    ($condition:expr, $($args:expr),* $(,)?) => { ... };
}
Expand description

Asserts that a condition is true.

If the condition evaluates to false, this macro logs a panic banner, logs the failure (including line number and optional custom message) at FATAL level using pw_log, and then calls pw_assert_HandleFailure.

ยงExamples

let x = 5;
pw_assert::assert!(x > 0);
pw_assert::assert!(x == 5, "x should be 5, but was {}", x as i32);