arkod
arkod

Reputation: 2063

Is the question mark operator ? equivalent to the try! macro?

I am looking for a way to chain the usage of the try! macro in Rust and found this pull request that implements the ? operator.

It seems like it has been merged, but I cannot seem to find any documentation on it yet. Is it equivalent to the try! macro or are there important differences?

Upvotes: 31

Views: 13003

Answers (1)

Chris Emerson
Chris Emerson

Reputation: 14021

Yes, the ? operator is equivalent to try!(). ? is now in stable Rust 1.13, released on November 10, 2016.

The best source of documentation at the moment seems to be RFC 0243. Note that the catch described in the RFC is not yet implemented at this writing (issue).

Upvotes: 44

Related Questions