Give more enum motivation in the intro paragraph

Taking suggestions from @aturon. I like how this foreshadows why this
chapter has sections on patterns.

Connects to #106.
This commit is contained in:
Carol (Nichols || Goulding) 2016-06-29 22:06:24 -06:00
parent b113cc9014
commit c7979df8b2

View File

@ -1,12 +1,13 @@
# Enums
Next, lets look at a feature of Rust thats similar to structs, but also
different. Enumerations, or enums as theyre more commonly called,
are an extremely powerful feature of Rust. Enums are a feature that are in many
languages, but what they can do is different per-language. Rusts enums are
most similar to enums in functional languages.
Next, lets look at *enumerations*, which allow you to define a type by
enumerating its possible values. Commonly called "enums", these unlock a lot of
power in Rust when combined with pattern matching. Enums are a feature that are
in many languages, but what they can do is different per-language. Rusts enums
are most similar to "algebraic data types" in functional languages like F#,
OCaml, or Haskell.
Heres an example of an enum:
Heres an example of an enum definition:
```rust
enum IpAddrKind {