Compare commits

..

2 Commits

Author SHA1 Message Date
KaiserY
e675c74913
Merge pull request #820 from yizhao1998/main
Update ch06-01-defining-an-enum.md
2024-10-04 23:42:53 +08:00
Yi Zhao
7448984c65
fix translation issue 2024-10-04 11:00:34 -04:00

View File

@ -26,7 +26,7 @@
{{#rustdoc_include ../listings/ch06-enums-and-pattern-matching/no-listing-01-defining-enums/src/main.rs:instance}} {{#rustdoc_include ../listings/ch06-enums-and-pattern-matching/no-listing-01-defining-enums/src/main.rs:instance}}
``` ```
注意枚举的成员位于其标识符的命名空间中,并使用两个冒号分开。这么设计的益处是现在 `IpAddrKind::V4``IpAddrKind::V6` 都是 `IpAddrKind` 类型的。例如,接着可以定义一个函数来获取任何 `IpAddrKind` 注意枚举的成员位于其标识符的命名空间中,并使用两个冒号分开。这么设计的益处是现在 `IpAddrKind::V4``IpAddrKind::V6` 都是 `IpAddrKind` 类型的。例如,接着可以定义一个函数来接收任何 `IpAddrKind`类型的参数
```rust ```rust
{{#rustdoc_include ../listings/ch06-enums-and-pattern-matching/no-listing-01-defining-enums/src/main.rs:fn}} {{#rustdoc_include ../listings/ch06-enums-and-pattern-matching/no-listing-01-defining-enums/src/main.rs:fn}}