3 ms·
This is what Rust does. Not to try to summarize the article, but functions which could 'throw exceptions' instead of returning type T, return type Result<T, E>,
by tatterdemalion 11y ago
This is what Rust does. Not to try to summarize the article, but functions which could 'throw exceptions' instead of returning type T, return type Result<T, E>, where E is an Error type. The try!() macro wraps an expression that could be an error, returning early with the error value if it is an error and evaluating to the non-error value if it is not an error.
EDIT: Oh, I see, you mean without having to declare it.