mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 20:24:32 -06:00
Merge pull request #132 from GeertVL/patch-1
attach instead of attatch typo
This commit is contained in:
@@ -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
|
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
|
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
|
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
|
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:
|
struct, we’d be stuck. But enums deal with this case with ease:
|
||||||
|
|||||||
Reference in New Issue
Block a user