You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ anodized = "0.1.0"
27
27
28
28
Use the `#[contract]` attribute to define preconditions (`requires`), postconditions (`ensures`), and invariants (`maintains`). Each _condition_ is a standard Rust expression that evaluates to `bool`. In postconditions, the function's return value is available as `output`.
29
29
30
-
```rust
30
+
```rust,ignore
31
31
use anodized::contract;
32
32
33
33
#[contract(
@@ -51,7 +51,7 @@ fn main() {
51
51
52
52
In a **debug build** (`cargo run` or `cargo test`), your code is automatically instrumented to check the contracts. A contract violation will cause a panic with a descriptive error message:
53
53
54
-
```
54
+
```ignore
55
55
thread 'main' panicked at 'Precondition failed: divisor != 0', src/main.rs:17:5
56
56
```
57
57
@@ -89,7 +89,7 @@ A condition is a `bool`-valued Rust expression; as simple as that. This is a non
89
89
90
90
You can include any number of each flavor. Multiple conditions of the same flavor are combined with a logical **AND** (`&&`).
91
91
92
-
```rust
92
+
```rust,ignore
93
93
#[contract(
94
94
// These two preconditions are equivalent to a single
The `binds` parameter also lets you destructure return values, making complex postconditions easier to read and write. You can use any valid Rust pattern, including tuple patterns, struct patterns, or even more complex nested patterns.
0 commit comments