Rust Macro assert!

macro_rules! assert {
    ($cond:expr) => { ... };
    ($cond:expr,) => { ... };
    ($cond:expr, $($arg:tt)+) => { ... };
}

Asserts that a boolean expression is true at runtime.

在运行时断言布尔表达式为“ true”。

This will invoke the panic! macro if the provided expression cannot be evaluated to true at runtime.

如果提供的表达式在运行时无法评估为true,则将调用[panic!]宏。

即表达式为true则继续运行,为false调用panic宏程序退出。

原文地址:https://www.cnblogs.com/kuikuitage/p/13431000.html