liveBook · Manning

Option

As explained in Code Like a Pro in Rust

An option type is a type that explicitly represents either a value of a specified type or the absence of a value.

Rust’s Option represents a value that may be absent: Some holds a value, while None safely represents absence without a null pointer. Use it when boxed data may be missing. section 5.5

How Code Like a Pro in Rust covers it

How deep it goes
Defines Some and None through linked-list access, while leaving heap-allocation failure handling outside scope.
Examples
Uses None for a new node’s next link and Some to traverse to the next node.
What you can do after
Apply Rust’s Option to represent absent data without relying on unsafe null pointers.
How it connects
Connects Option with Box, null pointers, and singly linked lists.

Also explained in

Compare how 9 books explain option →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Code Like a Pro in Rust. The section links point to the parts of the book it draws on.