Runtime asserts for ZZ
Add this to your zz.toml file:
[dependencies] runtime_assert = "*" [repos] runtime_assert = "git+ssh://github.com/zzmodules/runtime-assert.git"using runtime_assertMakes a runtime assertion. Upon failure, this function will call abort_signal::abort().
using runtime_assert::{assert } fn main() -> int{assert(false); // will abort herereturn0}An abort signal callback function handler can be set to catch errors.
using abort_signal::{set_abort_callback } using log using runtime_assert::{assert } static usize mut aborts = 0; fn onabort(){aborts++} fn main() -> int{set_abort_callback(onabort); assert(false); assert(false); assert(false); log::info("fails = %lu", aborts); // 3return0}MIT