<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Result on Nalar</title>
    <link>https://nalar.dev/tags/result/</link>
    <description>Recent content in Result on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 01 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/result/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Practical Error Handling in Rust with Result and the ? Operator</title>
      <link>https://nalar.dev/rust-error-handling-result-question-mark/</link>
      <pubDate>Tue, 01 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/rust-error-handling-result-question-mark/</guid>
      <description>&lt;p&gt;Rust makes recoverable failure part of a function&amp;rsquo;s type. Instead of relying on exceptions, operations that can fail commonly return &lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt;, forcing callers to either handle the error or propagate it.&lt;/p&gt;&#xA;&lt;p&gt;That explicitness can feel verbose at first. The &lt;code&gt;?&lt;/code&gt; operator and well-designed error types keep the code concise without hiding failure paths.&lt;/p&gt;&#xA;&lt;h2 id=&#34;result-represents-success-or-failure&#34;&gt;Result represents success or failure&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt; has two variants:&lt;/p&gt;&#xA;&lt;div &#xA;    x-data=&#34;{&#xA;        code: $el.querySelector(&#39;code&#39;).innerText&#xA;    }&#34;&#xA;    class=&#34;relative my-4 rounded-lg group&#34;&#xA;&gt;&#xA;    &lt;button&#xA;        @click=&#34;navigator.clipboard.writeText(code); $el.innerText = &#39;Copied!&#39;; setTimeout(() =&gt; $el.innerText = &#39;Copy&#39;, 2000)&#34;&#xA;        class=&#34;absolute top-2 right-2 bg-neutral-700 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity&#34;&#xA;    &gt;&#xA;        Copy&#xA;    &lt;/button&gt;&#xA;    &#xA;    &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-rust&#34; data-lang=&#34;rust&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Ok(value)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Err(error)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Reading a file therefore returns either the file contents or an I/O error:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
