Module ore::assert[][src]

This is supported on crate feature test only.
Expand description

Assertion utilities.

Soft assertions

Soft assertions are like debug assertions, but they can be toggled on and off at runtime in a release build.

They are useful in two scenarios:

  • When a failed assertion should result in a log message rather a process crash.

  • When evaluating the condition is too expensive to evaluate in production deployments.

When soft assertions are disabled, the performance cost of each assertion is one branch on an atomic.

Ore provides the following macros to make soft assertions:

Due to limitations in Rust, these macros are exported at the crate root.

Statics

Whether to enable soft assertions.