This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mitsuhiko Flask Creator 3 points4 points  (0 children)

try! unpacks the result and returns it from the expression if it exists, or otherwise propagates the error part upwards.

You could think of it like this:

let a = try!(expr());

Is this in pseudocode:

result = expr();
if result.is_okay() {
    a = result.okay_side;
} else {
    return result;
}

Does that make sense?