impl<T, E> Result<T, E> { /// ```should_panic /// let x: Result<u32, &str> = Err("emergency failure"); /// x.unwrap(); // panics with `emergency failure` /// ``` #[inline] #[track_caller] #[stable(feature = "rust1", since = "1.0.0")] pub fn unwrap(self) -> T where E: fmt::Debug, { match self { Ok(t) => t, Err(e) => unwrap_failed("called `Result::unwrap()` on an `Err` value", &e), } } prelude impor
![Rustで初学者がつまづいたところメモ](https://cdn-ak-scissors.b.st-hatena.com/image/square/547b3b8e46f8e3b6f6ac0b42d4a03bc267b3262c/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--_ItqbLGA--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3ARust%2525E3%252581%2525A7%2525E5%252588%25259D%2525E5%2525AD%2525A6%2525E8%252580%252585%2525E3%252581%25258C%2525E3%252581%2525A4%2525E3%252581%2525BE%2525E3%252581%2525A5%2525E3%252581%252584%2525E3%252581%25259F%2525E3%252581%2525A8%2525E3%252581%252593%2525E3%252582%25258D%2525E3%252583%2525A1%2525E3%252583%2525A2%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3A%2525E3%252581%2525B2%2525E3%252582%25258D%2525E3%252581%2525A8%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EtL0FPaDE0R2h0Q2xQY3BpMXJObFZiNWRxakdyV2ZmUlNvWTZJUU5OQTV5NVc2dVE9czk2LWM%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)