LEVIATHAN vd52e79c4 · d52e79c486

Standard Library

enum ContractKind

What kind of check a ContractViolation reports.

since 0.1.0-alpha.1linuxwindowswasm

Overview

The codes run from 0 (Precondition) to 3 (Invariant) in declaration order.

Examples

use io::console;

ContractKind k = ContractKind::Postcondition;
console.writeln(k == ContractKind::Postcondition);
console.writeln(k.toString());
true
Postcondition

Members

Assertion

Assertion = 2

An assert statement failed.

Invariant

Invariant = 3

A class or struct invariant failed at the object's boundary.

Postcondition

Postcondition = 1

A post clause failed: the function broke its promise.

Precondition

Precondition = 0

A pre clause failed: the caller broke the function's requirement.

See also

  • ContractViolation — A violated contract: a failed pre, post, assert or invariant.