Rust · Macro
assert!
assert! checks that a Boolean expression is true while the program runs. If it is false, the macro panics; an optional custom message can explain the failure.
Last updated
- Since
- 1.38.0
Syntax
assert!($cond:expr $(,)?);
assert!($cond:expr, $($arg:tt)+);In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
panic!debug_assert!std::fmt