9 ms·
Well, you may be short-circuiting for any reason, from any signature. For example, look a Swift's guard statements. It even narrows the type down-scope after y
by always_good 9y ago
Well, you may be short-circuiting for any reason, from any signature.
For example, look a Swift's guard statements. It even narrows the type down-scope after you short-circuit.
If you borrow in the `match {expr}`, Rust still thinks it matters when you're trying to short-circuit in the `None` branch and will complain about the borrowed lifetime. Though this is something #![feature(nll)] fixes.
You can implement std::ops::Try for a custom data structure, but that doesn't help you in any of the cases where you just want to do some day-to-day short-circuiting without inventing your own data structure.
I shouldn't have used Option, though. It was a bad example.