Messages in this thread | | | Subject | Re: [PATCH 04/13] Kbuild: Rust support | From | Connor Kuehl <> | Date | Fri, 16 Apr 2021 15:34:50 -0500 |
| |
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.
| |