<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>syu-m-5151</author_name>
  <author_url>https://blog.hatena.ne.jp/syu-m-5151/</author_url>
  <blog_title>じゃあ、おうちで学べる </blog_title>
  <blog_url>https://syu-m-5151.hatenablog.com/</blog_url>
  <categories>
    <anon>Rust</anon>
  </categories>
  <description>はじめに Rust で Option や Result から値を取り出すとき、つい .unwrap() を書いてしまう場面があります。動くし短い。だから書く。だけどそのコードは、エラー時にスタックトレースなしで panic します。本番で踏むと 「どこで何の理由で死んだのか」 がわからない事故になります。 この記事は、.unwrap() を書きたくなった瞬間の代替案を8個並べます。状況に応じて選んでください。 前提: なぜ unwrap() は 良くないか .unwrap() の問題は3つです。 panic メッセージが「called \Option::unwrap()` on a `None…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsyu-m-5151.hatenablog.com%2Fentry%2F2026%2F05%2F01%2F195115&quot; title=&quot;`unwrap()` を書きそうになったときの選択肢8つ - じゃあ、おうちで学べる &quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2026-05-01 19:51:15</published>
  <title>`unwrap()` を書きそうになったときの選択肢8つ</title>
  <type>rich</type>
  <url>https://syu-m-5151.hatenablog.com/entry/2026/05/01/195115</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
