Jlrs 0.6: Support for Julia 1.5, many new builtin types, massively extended support for accessing data from Rust, automatically generate valid Rust structs from Julia structs

A few weeks ago Julia 1.5 was released. In this version the layout of structs was changed, before any struct with pointer fields couldn’t be stored inline but had to be hidden behind a pointer (a Value in jlrs). Now, immutable structs with pointer fields will be inlined. One of the results of this change is that arrays that contain immutable structs with pointer fields (eg a stacktrace) is no longer stored as an array of Values but as an inline array, in order to access its contents purely from Rust you have to provide a struct with the correct layout.

In order to make this possible the derive macros have received a massive overhaul in jlrs 0.6. First of all, JuliaTuple is gone and has been replaced with many generic tuple types. Second, JuliaStruct supports much more than bits types without type parameters and can now handle pointer fields, type parameters, and bits unions. Finally, you don’t even need to figure out the proper layout yourself, the JlrsReflect.jl package can be used to generate valid bindings automatically. This package should be available through Pkg soon.

Other changes include the availability of all datatypes defined in the Julia C API like TypeName and Expr, a raw string JuliaString, and the ability to set module globals and constants from Rust.

jlrs 0.6 is only compatible with Julia 1.5, earlier versions will not work.

Crates.io

7 Likes