Bindings and derivable traits
We've encountered several traits that shouldn't be implemented manually, but derived. These traits express connections between types in Rust and Julia and their properties.
The following traits can currently be derived:
-
ValidLayoutExpresses that the implementor represents the layout of one or more Julia types, i.e. it's a layout type. -
ValidFieldExpresses that the implementor represents the layout of one or more Julia types when used as a field of another type. -
IsBitsExpresses that the implementor is the layout of anisbitstype. -
TypecheckLets the implementor be used withDataType::isandValue::is, the implementation callsValidLayout::valid_layout. -
IntoJuliaLets the implementor be converted to managed data withValue::new. -
UnboxLets the implementor be used as the target type ofValue::unbox. -
ConstructTypeLets the implementor be used as a type constructor. -
HasLayoutLinks a type constructor to its layout type. -
CCallArgLets the implementor be used as an argument type of a function called viaccall. -
CCallReturnLets the implementor be used as the return type of a function called viaccall. -
EnumMaps the implementor to a Julia enum.
We can use JlrsCore.jl to generate bindings to Julia types which derive these traits if applicable. These bindings provide an interface to existing Julia types, and can't be used to expose Rust types to Julia.