Hacker News new | ask | show | jobs
by guitarbill 951 days 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.

1 comments

Oops! I'll make that correction later today. You're right: they're mutually exclusive
That'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.