Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

.unwrap()

Trả về giá trị nằm trong Some(T). Nếu giá trị là None thì panic chương trình.

#![allow(unused)]
fn main() {
let x = Some("air");
assert_eq!(x.unwrap(), "air");

let x: Option<&str> = None;
assert_eq!(x.unwrap(), "air"); // panic!
}