mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2024-11-14 21:11:31 +08:00
Compare commits
No commits in common. "e675c749137f687336008fabcdb1fb20d2b68f68" and "7261c9d5c5f7eb3438d3fd49d72c69b4d25a8199" have entirely different histories.
e675c74913
...
7261c9d5c5
@ -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}}
|
||||||
|
Loading…
Reference in New Issue
Block a user