Rust logo
Rust 1.79.0-nightly
c9f8f3438

Enums

There is a new edition of the book and this is an old link.

Enums allow you to define a type by enumerating its possible values.

enum IpAddrKind {
    V4,
    V6,
}
Run

Here are the relevant sections in the new and old books: