Skip to content

Runtime asserts for ZZ

License

Notifications You must be signed in to change notification settings

zzmodules/runtime-assert

Repository files navigation

runtime-assert

Runtime asserts for ZZ

Installation

Add this to your zz.toml file:

[dependencies] runtime_assert = "*" [repos] runtime_assert = "git+ssh://github.com/zzmodules/runtime-assert.git"

Usage

using runtime_assert

API

runtime_assert::assert(assertion)

Makes a runtime assertion. Upon failure, this function will call abort_signal::abort().

using runtime_assert::{assert } fn main() -> int{assert(false); // will abort herereturn0}

Catching assertion errors

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}

See Also

License

MIT

About

Runtime asserts for ZZ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages