Expand description
§pw_assert
pw_assert provides crash-safe assert and panic macros that route to a
configured backend. This is designed for embedded systems where standard
library panics might not be suitable, or where specific logging/recovery
behavior is needed.
The macros in this crate are designed to be drop-in replacements for
core::panic!, core::assert!, etc., and delegate to backend macros:
panic!anddebug_panic!->panic_backend!assert!anddebug_assert!->assert_unary_backend!eq!,ne!,debug_eq!, anddebug_ne!->assert_binary_backend!
§Example
pw_assert::assert!(42 == 16, "Stack start is not aligned");
pw_assert::panic!("Unhandled interrupt: irq={}", 16 as u32);
pw_assert::debug_assert!(1 == 0);
pw_assert::debug_panic!("Next monotonic tick overflow");Macros§
- assert
- Asserts that a condition is true.
- debug_
assert - Asserts that a condition is true when debug_assertions are enabled.
- debug_
eq - Asserts that two expressions are equal when debug_assertions are enabled.
- debug_
ne - Asserts that two expressions are not equal when debug_assertions are enabled.
- debug_
panic - Panics unconditionally when debug_assertions are enabled.
- eq
- Asserts that two expressions are equal (equivalent to
assert_eq!). - ne
- Asserts that two expressions are not equal (equivalent to
assert_ne!). - panic
- Panics unconditionally.