Rust match on number condition
<p>I have the following match condition that tests whether the entered guess is a valid number (it's from the rust guessing game exercise) :</p>

<pre><code>let mut guess = String::new(); 
io::stdin().read_line(&amp;mut guess).expect("Failed to read");
let guess: u32 = match guess.trim().parse() {
    Ok(num) =&gt; num,
    Err(_)  =&gt; continue,
};
</code></pre>

<p>How do I extend the match to check if the number is negative or 0 (I want to throw an error in this case) and proceed normally if the number is positive ?</p>

<p>I tried adding an if on the num inside the Ok case, but that throws an error (probably because num is bound to the value of guess) and also doesn't seem idiomatic. </p>