Skip to content

Commit

Permalink
Update print_debug.md (#187)
Browse files Browse the repository at this point in the history
derive 翻译为“派生”较为合适。
  • Loading branch information
qianbinbin committed Feb 7, 2024
1 parent d019fce commit 66800cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hello/print/print_debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

所有的类型,若想用 `std::fmt` 的格式化打印,都要求实现至少一个可打印的 `traits`。仅有一些类型提供了自动实现,比如 `std` 库中的类型。所有其他类型都**必须**手动实现。

`fmt::Debug` 这个 `trait` 使这项工作变得相当简单。所有类型都能推导`derive`,即自动创建)`fmt::Debug` 的实现。但是 `fmt::Display` 需要手动实现。
`fmt::Debug` 这个 `trait` 使这项工作变得相当简单。所有类型都能派生`derive`,即自动创建)`fmt::Debug` 的实现。但是 `fmt::Display` 需要手动实现。

```rust
// 这个结构体不能使用 `fmt::Display` 或 `fmt::Debug` 来进行打印。
Expand Down

0 comments on commit 66800cf

Please sign in to comment.