title: Avoiding redundant work when matching and parsing
body: <p>I'm using <code>match</code> to see if string input is a position, and if it does, convert it to a tuple. For example, "B6" would become (1, 5). I have the functions <code>is_pos</code> to math the right input and <code>parse_pos</code> to transform it, so each <code>match</code> needs to perform string parsing twice.</p>
  
  <pre><code>fn main() {
      let input = ""
      match input {
          "exit" =&gt; return,
          _ if is_pos(input) =&gt; parse_pos(input),
          _ =&gt; (0, 0),
      };
  }
  
  fn is_pos(str: &amp;str) -&gt; bool {
      // string processing
      true
  }
  
  fn parse_pos(str: &amp;str) -&gt; u32 {
      // the same string processing
      5
  }
  </code></pre>
  
  <p>I'd to have one function that returns an <code>Option</code>. Then the match would select the <code>Option</code> if it wasn't none, and I could unwrap it without needing to redo the string parsing.</p>
  
  <p>Is this possible with <code>match</code>, or should I go back to using if statements?</p>