Skip to content

Latest commit

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date

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

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages