Rust functions that accept and return tuples

C has no notion of tuples, but the closest analog is a plain
struct. You will need to create individual structs for each unique
combination of types. Here, we create a structure that represents two
32-bit unsigned integers.

#[repr(C)] is used to inform the compiler that it should arrange the
fields of the struct as a C compiler would. The two conversion
implementations use std::convert::From to provide ergonomic
conversion between the struct and a corresponding tuple.

Since we are conforming to C-compatible idioms, the implementation is
straight-forward. We define a struct with fields that match the
types and order of the Rust struct, then create an instance and call
the method.

To mirror the tuple structure definition, we create a struct using
the StructLayout property and define the layout as sequential. We
also provide some implicit conversion operators to make going between
types fairly seamless.

Julia struct types defined with the exact same field layout are
already compatible with C’s data arrangement. Since all fields are isbits, then so is the Tuple type. As such, it
will store each member inline and will be passed to the native
function by value.