Tour of Rust Table of Contents

Option

Rust has a built in generic enum called Option that allows us to represent nullable values without using null.

enum Option<T> {
    None,
    Some(T),
}

This enum is so common, instances of the enum can be created anywhere with the keywords Some and None.