3 ms·
The ? operator used to be the try! macro: https://doc.rust-lang.org/book/first-edition/error-handling.html#the-try-macro https://doc.rust-lang.org/book/first-ed
by cesarb 9y ago
The ? operator used to be the try! macro: https://doc.rust-lang.org/book/first-edition/error-handling.html#the-try-macro https://doc.rust-lang.org/book/first-edition/error-handling....
It's used for shortcut error handling: when for instance you receive an error result from opening a file, you usually want to also return with an error. It was used so often that the ? operator was introduced as a shortcut. Now the operator is being extended to Option<T>, which works similar to Result<T, ()>.