title: Generic placeholders or default values in Rust
body: <p>I'm trying to write a generic command line parser. I'm having trouble with "default" values for generic types. <code>cmd.invoke()</code> returns a <code>Result&lt;K, E&gt;</code>, so there's no problem there, but how do I represent a placeholder or default value for <code>E</code> when <code>cmd_to_invoke</code> is a <code>None</code>? In C#, I could use <code>default(E)</code>. Is there a construct like this in Rust?</p>
  
  <pre><code>pub struct Cmd&lt;K, E&gt; {
      cmds: Vec&lt;Cmd&lt;K, E&gt;&gt;,
  }
  
  impl&lt;K, E&gt; Cmd&lt;K, E&gt; {
      pub fn invoke(&amp;mut self, cmd_name: &amp;str) -&gt; Result&lt;K, E&gt; {
          let cmd_to_invoke = self.cmds.iter_mut().find(|cmd| cmd.name == cmd_name);
          if let Some(cmd) = cmd_to_invoke {
              cmd.invoke()
          } else {
              // Some default / placeholder value for E
              Err(/* ? */)
          }
      }
  }
  </code></pre>