Skip to content

Glossary: Rust Basics

unwrap

Also written: unwrap(), unwrap_or, unwrap_or()

`unwrap()` takes the value out of an `Ok` or `Some` and panics if there isn't one; `unwrap_or(0)` gives a default you choose instead.

Where the book teaches it

Related terms

expectOptionResultPanic