Crate dbc [] [src]

Design-by-Contract for Rust

Design by Contract is a programming methodology which binds the caller and the function called to a contract. The contract is represented using Hoare Triple: {P} C {Q}, where {P} is the precondition before executing command C, and {Q} is the postcondition.

Like debug_assert!, dbc macros are only enabled in non optimized builds by default. An optimized build will omit all dbc macro statements unless -C debug-assertions is passed to the compiler.

See Also

Note

This library is similar to my godbc for Golang.

Macros

ensure

Postcondition tests

formatvar

Stringify one or more variables and their values

invariant

Invariant condition assertion

require

Precondondition tests

Traits

Invariant

The Invariant trait allows for asserting an object