Skip to content

Glossary: Data Structures and Algorithms in Rust

unwrap() and expect()

Also written: unwrap, expect, unwrap_or

Methods that take the value out of an `Option` and panic if it is `None`; `expect` lets you supply the panic message. They are best used only where a value is certain to be present, such as right after a check.

Where the book teaches it

Related terms

OptionPanic