Skip to content

Commit

Permalink
doc: coerce macro change
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Sep 18, 2024
1 parent a173e0b commit 0a6bca5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ You can even redeclare the same inline struct in a different set, change the dis
**coerce_macro:** Each error set will generates a `coerce!` macro to help handle coercion between partially intersecting sets.

```rust
let val = coerce!(setx => {
Ok(val) => val,
Err(SetX::X) => {}, // handle disjointedness
{ Err(SetX) => return Err(SetY) } // terminal coercion
})?;
let val = coerce!{ setx,
Ok(val) => val,
Err(SetX::X) => {}, // handle disjointedness
{ Err(SetX) => return Err(SetY) } // terminal coercion
}?;
```

<details>
Expand Down Expand Up @@ -508,11 +508,11 @@ Given:

```rust
fn setx_result_to_sety_result() -> Result<(), SetY> {
let _ok = coerce!(setx_result() => {
let _ok = coerce!{ setx_result(),
Ok(ok) => ok,
Err(SetX::X) => {}, // handle disjointedness
{ Err(SetX) => return Err(SetY) } // terminal coercion
});
};
Ok(())
}
```
Expand Down

0 comments on commit 0a6bca5

Please sign in to comment.