Expand description

Wrapper for arbitrary Julia data.

Julia data returned by the C API is often returned as a pointer to jl_value_t, which is an opaque type. This pointer is wrapped in jlrs by Value. The layout of the data that is pointed to depends on its underlying type. Julia guarantees that the data is preceded in memory by a header which contains a pointer to the data’s type information, its DataType.

For example, if the DataType is UInt8, the pointer points to a u8. If the DataType is some Julia array type like Array{Int, 2}, the pointer points to Julia’s internal array type, jl_array_t. In the first case tha value can be unboxed as a u8, in the second case it can be cast to Array or TypedArray<isize>.

The Value wrapper is very commonly used in jlrs. A Value can be called as a Julia function, the arguments such a function takes are all Values, and it will return either a Value or an exception which is also a Value. This wrapper also provides methods to create new Values, access their fields, cast them to the appropriate pointer wrapper type, and unbox their contents.

One special kind of value is the NamedTuple. You will need to create values of this type in order to call functions with keyword arguments. The macro named_tuple is defined in this module which provides an easy way to create values of this type.

Structs

Access the raw contents of a Julia value.

While jlrs generally enforces that Julia data can only exist and be used while a frame is active, it’s possible to leak global values: Symbols, Modules, and globals defined in those modules.

See the [module-level documentation] for more information.

Constants

In some cases it’s necessary to place one or more arguments in front of the arguments a function is called with. Examples include the named_tuple macro and Value::call_async. If they are called with fewer than MAX_SIZE arguments (including the added arguments), no heap allocation is required to store them.

Type Definitions

A reference to a Value that has not been explicitly rooted.