4 ms·
> Rust returns returns errors using a "wrapper" type called Result. A Result contains both a non-error value (Ok) and an error value (Err) A `Result` can conta
by guitarbill 3y ago
> Rust returns returns errors using a "wrapper" type called Result. A Result contains both a non-error value (Ok) and an error value (Err)
A `Result` can contain either a non-error value (Result::Ok) or and error value (Result::Err), never both.
- goodoldneon 3y agoOops! I'll make that correction later today. You're right: they're mutually exclusive
- guitarbill 3y agoThat's what makes it good :) Well, that and the fact you have to unpack/destructure the result somehow to get at the value (or the error), so you're forced to handle it.