Re: [PATCH 04/13] Kbuild: Rust support

From: Connor Kuehl
Date: Fri Apr 16 2021 - 16:34:59 EST


On 4/16/21 3:22 PM, Willy Tarreau wrote:
> So it simply does the equivalent of:
>
> #define EINVAL -1234
>
> struct result {
> int status;
> int error;
> };

Result and Option types are more like a union with a tag that
describes which variant it is.

struct foo_result {
/* if ok, then access foo_or_err.successful_foo
* else, access foo_or_err.error
*/
bool ok;
union {
struct foo successful_foo;
int error;
} foo_or_err;
};

> [..]
>
> So it simply returns a pair of values instead of a single one, which

It will only return 1 value.