4 ms·
It supports that kind of error handling too, fn something() -> (String, String) ... let (result, err) = something() It's just that Result is preferable becau
by yarper 10y ago
It supports that kind of error handling too,
fn something() -> (String, String)
...
let (result, err) = something()
It's just that Result is preferable because you can pattern match on it
- kazagistar 10y agoThat would be fn something() -> (Option<String>, Option<String>) Because the Rust types aren't nullable by default. But that more clearly demonstrates that Result types are better since they enforce that the error and result are mutually exclusive.
- yarper 10y agoagreed!