title: Best practice to return a Result<_, impl Error> and not a Result<_, &str> in Rust?
body: <p>Is it ok practice to have this style <code>Result</code>? </p>
  
  <pre class="lang-rust prettyprint-override"><code>fn a() -&gt; Result&lt;u32, &amp;'static str&gt;
  </code></pre>
  
  <p>And then what is the purpose of the Error trait? <a href="https://doc.rust-lang.org/std/error/trait.Error.html" rel="nofollow noreferrer">https://doc.rust-lang.org/std/error/trait.Error.html</a></p>
  
  <p>Is an impl Error Result better practice?</p>
  
  <pre class="lang-rust prettyprint-override"><code>impl Error for MyError {..... }
  fn a() -&gt; Result&lt;u32, MyError&gt;
  </code></pre>