About
This library can be used to automatically derive the MIR layout from a rust type.
Currently, structs and enums are supported, unions are still work in progress.
Since EDL usually interfaces with Rust code that is compiled with the very same rustc version as the EDL compiler
itself, this derive macro does not require the data structs to be #[repr(C)].
However, since there is currently no stable way to figure out where the Rust compiler places the discriminator in an
enum type, enums must be #[repr(u8)] if they are to be used with MirLayout.
Generic types are supported. The derive adds a T: MirLayout + 'static bound to every type parameter of the type,
so all field types must themselves implement MirLayout. Const generic parameters are supported as well, but
lifetime parameters are not, since the MirLayout ecosystem requires all types to be 'static.
Examples
For all of the following examples, the data layout can be printed out using
use Arc;
use ;
use MirLayout;
Example struct
Example enum
Example generic struct
// the bounds `T: MirLayout + 'static` are added by the derive,
// the layout is computed for each concrete instantiation
layout;
layout;