Earlier versions of jlrs required you to manually include a file called jlrs.jl which contains some custom Julia code that is necessarry to use some features. This file is now included as a string in the library and is evaluated when Julia is initialized, meaning its functionality is always available and up-to-date.
Creating a Julia value from Rust has been possible in many cases (e.g. primitives, bits-structs, arrays, and symbols), but types with type parameters or pointer fields were limited to a few special cases. Type parameters can now be filled in with Value::apply_type
and arbitrary types can be instantiated with Value::instantiate
. Methods that let you create a UnionAll
, a Union
, or a TypeVar
are also available. The constants defined in the C API have been added, which means you can access many items defined in the Core
module directly. With these changes, a specific type can now be created from Rust: the NamedTuple
. These are used, for example, to hold the keyword arguments of functions that take them. The easiest way to create a named tuple is by using the named_tuple!
macro which accepts an arbitrary number of key-value pairs.
The Julia standard library contains many modules in addition to Core
and Base
, such as LinearAlgebra
and Dates
. Packages can be easily installed from the REPL. In order to use these modules and packages in Julia you use import
and using
statements. The method Module::require
has been added to jlrs, it lets you load modules from the standard library and packages.
The final major new feature is the addition of two new ways to call functions. With Value::eval_(c)string
you can execute the contents of a string. With Value::with_keywords
you can provide a function that takes keyword arguments with those arguments to override their default values.