Skip to content

Commit

Permalink
Merge pull request #796 from synhi/patch-1
Browse files Browse the repository at this point in the history
Update ch09-03-to-panic-or-not-to-panic.md
  • Loading branch information
KaiserY authored Jun 19, 2024
2 parents 5f7349f + 3e45c27 commit 88f3d3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ch09-03-to-panic-or-not-to-panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
相反我们可以创建一个新类型来将验证放入创建其实例的函数中,而不是到处重复这些检查。这样就可以安全地在函数签名中使用新类型并相信它们接收到的值。示例 9-13 中展示了一个定义 `Guess` 类型的方法,只有在 `new` 函数接收到 1 到 100 之间的值时才会创建 `Guess` 的实例:

```rust
{{#include ../listings/ch09-error-handling/listing-09-13/src/lib.rs:here}}
{{#rustdoc_include ../listings/ch09-error-handling/listing-09-13/src/lib.rs:here}}
```

<span class="caption">示例 9-13:一个 `Guess` 类型,它只在值位于 1 和 100 之间时才继续</span>
Expand Down

0 comments on commit 88f3d3f

Please sign in to comment.