Module jlrs::data::layout

source ·
Expand description

Type and field layouts of Julia data.

The layout of an instance of a Julia type depends on the types of its fields. There are essentially three ways a field is represented in the layout of the containing type: inline, as a reference to Julia data, or as a bits union.

As a rule of thumb you can assume a field whose type is a concrete, immutable and not a union type is stored inline; a field that is a union of immutable types, none of which contain references to Julia data, is stored as a bits union; all other types are stored as references to Julia data. Due to these different storage modes, a valid layout for a Julia type isn’t necessarily a valid layout for a field of that type. The ValidLayout and ValidField are available to handle the distinction.

You shouldn’t implement layouts for Julia types manually, but rather use the functionality from the JlrsCore.Reflect module to generate them and derive all applicable traits.

Modules

  • Layout type for Bool.
  • Layout type for Char.
  • Layout type for Float16.
  • Marker trait for layouts that only use isbits types.
  • Layout type for Nothing.
  • Layout type for SSAVAlue.
  • Generic Tuples of different sizes.
  • Fully-typed layout.
  • Enforce layout requirements of union fields.
  • Traits to check if a Rust type and a Julia type have matching layouts.