mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 23:38:41 +08:00
Merge pull request #132 from GeertVL/patch-1
attach instead of attatch typo
This commit is contained in:
commit
1ebfe890b4
@ -80,7 +80,7 @@ let loopback = IpAddr::V6(String::from("::1"));
|
||||
|
||||
We can attach data to each variant of the enum directly. No need for an extra
|
||||
struct. But beyond that, this approach is better than using a struct alongside
|
||||
our enum because we can attatch different kinds of data to each variant.
|
||||
our enum because we can attach different kinds of data to each variant.
|
||||
Imagine that instead of a `String`, we would prefer to store a `V4` as its four
|
||||
individual components, while leaving the `V6` variant as a `String`. With our
|
||||
struct, we’d be stuck. But enums deal with this case with ease:
|
||||
|
Loading…
Reference in New Issue
Block a user