-
Add several aliases for
JuliaResult
so they can be more easily returned from an exported funtion. -
Add
JuliaResultExt
andJuliaResultExt
extension traits to expose methods to leak or root a result. -
Add
into_ref
method toManagedRef
that converts an arbitraryManagedRef
to a specificRef
type. -
It's no longer possible to spawn a multithreaded runtime, it must be started. Spawning has been removed to avoid issues due to adopting threads that live longer than the runtime thread.
-
The multithreaded runtime uses scoped threads internally, this allows closures to reference non-static data and ensures the adopted threads have exited before the runtime thread, but requires calling
MtHandle::spawn
to spawn a new thread. -
The
julia-1-6
,julia-1-7
,julia-1-8
, andjulia-1-9
features have been removed. -
The
Executor
,AsyncTask
, andPersistentTask
traits no longer useasync_trait
. To migrate existingPersistentTask
s, remove theasync_trait
-annotation.AsyncTask
s now takeself
by value, so to migrate them remove the annotation and change&mut self
inrun
toself
. -
The async runtime supports using async closures when the
async-closure
feature is enabled, this requires using at least Rust 1.85. TheAsyncTask
trait has been implemented for all async closuresAsyncFnOnce(AsyncGcFrame) -> T
, so async closures can easily be called withAsyncHandle::task
. Async closures can also be used in combination with nested async scopes by callingAsyncGcFrame::async_scope_closure
, which doesn't suffer from the same lifetime issues asAsyncGcFrame::async_scope
. The methodsAsyncGcFrame::async_scope
andAsyncGcFrame::relaxed_async_scope
and the feature gate itself will be removed in the future when the MSRV is increased.
-
Support generating bindings for Julia enums with integer base types in combination with JlrsCore.Reflect and the
Enum
derive macro. -
Fix several bugs related to how type parameters are handled in code generated by
julia_module!
. -
TypedValue::as_typed_ranked_array
andTypedValue::as_typed_array
have been added, these methods convert a type value with an array type constructor to the correspondingTyped(Ranked)Array
type.
-
Add support for Julia 1.11. Bump MSRV to 1.77.
-
The layout of builtin types defined by the C API like
jl_datatype_t
andjl_module_t
are opaque to jlrs. Any access to their internals is delegated to functions defined in jl-sys's support library. -
The support library can be compiled with support for cross-language LTO by enabling the
lto
feature. -
Bindings to the C API are written manually. A few features of Julia make it annoying to use bindgen to generate them.
-
Unused internal types have been removed,
Expr
is no longer considered an internal type. -
Static symbols can be defined with the
define_static_symbol
macro. -
Arrays have been redesigned to be more consistent with the rest of jlrs: there is a single fundamental array type,
ArrayBase
, and a bunch of aliases that expose additional static type information if desired. The first type parameter of aTypedArray
is the type constructor of the element type, not the element type's layout. Many functions now return aTypedArray
instead of anArray
. -
Array functions that have been removed in Julia 1.11, like
jl_reshape_array
, have been removed completely. Call the Julia function instead. -
Separate types are used for different array accessors.
-
The
construct_type_with_env
method has been added toConstructType
, it can be used to construct types which take type parameters from an environment. -
Async callbacks have been removed from
julia_module
. You can useBackgroundTask
orDelegatedTask
instead, the latter is available since Julia 1.9. Background tasks can't access Julia data or call into Julia, delegated tasks can. -
RustResult
has been removed. -
Generic functions that take type parameters from an environment can be exported to Julia with
julia_module
. -
Support for async-std has been dropped.
-
The async runtime can no longer be created with additional worker threads. Tasks no longer have an affinity.
-
tokio's oneshot channel is always used to transfer the result of a task.
-
async-channel is always used to communicate with the async runtime and persistent tasks.
-
The
AsyncRuntime
trait has been renamed toExecutor
. Fewer functions and types have to be implemented to define a custom executor. -
A multithreaded runtime is available when
multi-rt
is enabled, it requires using at least Julia 1.9. It allows calling into Julia from arbitrary threads, and can be combined with the async runtime to create thread pools that can call into Julia. These thread pools replace the worker threads the async runtime used to have. -
The number of threads that Julia starts can be configured with
Builder
, even if no async runtime is used. -
The sync runtime has been deprecated in favor of the local runtime. The feature
sync-rt
has been renamed tolocal-rt
. -
The Julia runtime is accessed through handles. Different runtime modes have different handle types; e.g. the local runtime has a
LocalHandle
, the async runtime anAsyncHandle
, etc. -
WeakHandle
has been added as an alternative toUnrooted
, aWeakHandle
can be acquired from any thread known to Julia and is pinned to the current stack frame. -
The local runtime does not automatically allocate a stack, this can be done manually with the
Stack::with_stack
method. Using local scopes is strongly recommended over dynamic scopes. All handles can allocate a stack. -
Scopes can return arbitrary types, the return type is no longer required to be a
JlrsResult
. -
Custom diagnostics are emitted when
ValidLayout
,Unbox
,IntoJulia
,ConstructType
,Typecheck
orForeignType
has not been implemented to explicitly warn you probably don't wantForeignType
's blanket impementations for these traits. This requires enabling thediagnostics
feature and Rust 1.78. -
Initializing Julia is considered safe as long as no custom system image is used.
-
A GC-safe
GcSafeRwLock
,GcSafeMutex
,GcSafeFairMutex
, andGcSafeOnceLock
have been added. These synchronization primitives allow for garbage to be collected while waiting for access to be granted. -
The
ConstructType
trait has gained an associated type and constant, and two new trait methods. The associatedStatic
type provides a unique, static Rust type for the type constructor, which must beSelf
with static lifetimes. The associated constantCACHEABLE
indicates whether the constructed type should be cached if it's a leaf type. Theconstruct_type
method uses the cached entry if it's available, or construct and cache it when supported otherwise. Theconstruct_type_uncached
method always constructs the type without checking if a cached entry exists. Thetype_id
method returns the type id of the associatedStatic
type, which is used internally as a key for the cache. -
Value
s can be instantiated from a layout and a type constructor withValue::try_new_with
. This method copies the provided layout from Rust to Julia if the provided type constructor is compatible with the provided layout. This method is also available forTypedValue
. -
The
ValidLayout
trait has gained atype_object
method. This method must return the Julia type object associated with this type. Its main use is correctly handling unions inValue::try_new_with
. -
The
ParametricBase
andParametricVariant
traits have been added which let you create opaque types with type parameters. -
Opaque types, functions, methods and async functions with type parameters can be exported by iterating over an array of types with a
for
loop injulia_module
. These loops can be nested, types provided by outer loops can be used in inner loops. Duplicate implentations are filtered as long as the item is only exported once. -
Constantly-sized frames can be allocated on the stack by creating a local scope, all targets allow creating a new local scope. This construct is used for all functions that used to take an
ExtendedTarget
, they now only need aTarget
. This involves three new targets:LocalGcFrame
,LocalOutput
, andLocalReusableSlot
. Trying to reserve a new slot when the frame is full causes apanic
. -
Functions and methods exported by the
julia_module
macro no longer need to return aRustResultRet
to throw an exception. The exception can now be thrown directly from Rust. The return type of the exported function no longer needs to account for exceptions if they can only occur due to trackingself
. If a function should throw an exception, the function can return either aJlrsResult<RetTy>
or aResult<RetTy, ValueRet>
. Such a result will either be converted to the output type or thrown as an exception. -
The
c-unwind
feature has been added. When this feature is enabled, all C functions use theC-unwind
ABI rather than theC
ABI. -
Symbol
s and constructed types are cached. Accessing a global in a module can also be cached withModule::typed_global_cached
. -
Exceptions can be caught by calling
catch_exceptions
. -
Exported functions and methods can be declared to be GC-safe with the
#[gc_safe]
attribute. -
Exported methods that take
self
can skip tracking with the#[untracked_self]
attribute. -
Types that have no pointer fields can implement
IsBits
. This trait is automatically derived if appropriate byJlrsCore.Reflect.reflect
. -
Type constructors can be associated with their layout by implementing
HasLayout
. This trait is automatically derived if appropriate byJlrsCore.Reflect.reflect
, or implemented by blanket implementation if the type constructor and layout are the same type. -
Value::new_named_tuple
takes a sized array of key-value pairs to avoid heap-allocations. -
A
DimsExt
trait has been added to optimize creating new arrays. WhileDims
can be implemented by crates that use jlrs,DimsExt
is sealed. -
When a runtime feature is enabled fast TLS is enabled. Crates like rustfft-jl that don't embed Julia must not enable any runtime features.
-
Exported functions and methods that should throw can do so by returning a
JlrsResult
orResult<_, ValueRet>
.RustResult
has been deprecated in favor of returning one of these types. -
Some functions need to insert additional arguments before the provided arguments. Examples include calling functions with keyword arguments and functions that call a Julia function asynchronously. These functions now take their arguments as an implementation of
Values
, which can add the extra arguments without having to allocate space for them on the heap if the number of arguments is known at compile-time. -
Call::call_unchecked
has been added to call a Julia function without catching the exception if one is thrown. -
Type aliases can be defined with the
julia_module
macro. -
The
full-no-rt
feature has been added to allow selecting all features except runtimes.
-
jlrs is compatible with Julia 1.7 again, but this version isn't actively tested or supported. Version features have been added to select a particular version of Julia, picking a specific version is required.
-
The
wrappers
module has been renamed todata
. Pointer wrappers are now called managed data, and inline wrappers are layouts. Traits and methods dealing with wrappers have been renamed accordingly. -
The traits in the
layout
module have been moved to thedata
module. Most can be found indata::layout
,typecheck
has been moved todata::types
, andfield_index::FieldIndex
has been moved todata::managed::value::field_accessor
. -
Tasks must now declare their affinity with an associated
Affinity
type, the affinity can be eitherDispatchAny
,DispatchMain
, orDispatchWorker
. Thetry_
methods have been removed fromAsyncJulia
, the non-try methods are now sync and return aDispatch
which is used to actually dispatch the task to the async runtime. Which dispatching methods are available for the returned instance ofDispatch
depends on theAffinity
of the task. There is both an async and a sync variant for each dispatching method, the async variant waits until the task can be dispatched, the sync variant returns the dispatcher if the targeted queue is full to allow retrying to dispatch the task. -
The
Compatible
trait has been added which allows a type that implementsValidLayout
to declare that it has exactly the same layout as another type. TheCompatibleCast
trait lets references to and arrays of types that implementValidLayout
to be cast to that compatible type without copying the data. -
ForeignType
requiresSend + Sync
, whether aForeignType
is large or contains pointers to managed data is now expressed with the associated constantLARGE
, the super type is returned by the trait methodForeignType::super_type
. Foreign types can be reinitialized withreinit_foreign_type
, which is available since Julia 1.9. -
OpaqueType
has been added, which is similar toForeignType
except that it can't contain any references to Julia data. -
A managed type for
Binding
has been added, this is available since Julia 1.10. -
The
Jlrs
Julia module is no longer included with jlrs, but published as a separate package,JlrsCore
. -
The jlrs-derive crate is now part of jlrs-macros. Two additional macros are available:
julia_version
can be used as an alternative to writing big cfgs to handle differences between Julia versions, andjulia_module
to generate the data thatJlrsCore.Wrap
uses to make the exported functions, methods, types, constant and globals available in a Julia module. -
Several traits have been added to implement the
julia_module
macro:CCallArg
,CCallReturn
, andConstructType
, the first two provide a mapping from a Rust type to the types Julia should use in generated Julia functions, the latter is used to construct theDataType
at runtime. The managed typeTypedValue
has been added to make more types constructible, andRustResult
to enable writing fallibleccall
able functions. Similarly,RankedArray
andTypedRankedArray
have been added. ACCallRef
type has been added to work with JuliaRef
s that have been used as arguments ofccall
ed functions. -
The
no-link
feature has been added to skip linking Julia. -
Dims::n_dimensions
has been renamed toDims::rank
. -
RankedArray
andTypedRankedArray
have been added to thearray
module. -
Symbol::generate
andSymbol::generate_tagged
have been added. -
LeakedValue
has been removed in favor of making managed data generally leakable by erasing the'scope
lifetime withManaged::leak
orRef::leak
. -
CCall
now hasinvoke
methods to avoid having to manually create a stack frame. -
Global Julia data can be cached in a static container by using
StaticGlobal
andStaticRef
. -
TrackArray
has been removed, the trait methods are now implemented directly by(Typed)Array
. The tracking methods have been renamed totrack_shared
andtrack_exclusive
. -
DataType
methods that depend on the type having a layout returnNone
if the type has no layout. -
Methods that can catch a thrown exception are now available on Windows in combination with Julia 1.6.
-
Atomic struct fields are now atomic in the generated bindings.
-
Value
implementsPartialEq
for all wrapper types, allowing a value to be compared with any other wrapper type directly. -
JuliaString::to_bytes
has been renamed toJuliaString::as_bytes
, and returns all data. -
If a
JuliaString
is unboxed and contains non-utf8 data, all data is returned as aVec<u8>
rather than stopping at the first null character. -
The GC stack is now implemented as a foreign type and can be resized. Methods that could previously only fail due to allocation errors are now infallible.
AllocError
has been removed. -
When the sync runtime or
CCall
is used, a reference to aStackFrame
must be provided. -
Frame
,Mode
,Sync
andAsync
have been removed. -
AsyncGcFrame
implementsDeref<Target = GcFrame>
andDerefMut
. Several methods that previously took a mutable reference to a frame now take a mutable reference to aGcFrame
specifically. -
Some fields of
Task
andTypeName
can only be accessed if theextra-fields
feature is enabled. -
Methods that return Julia take a
Target
,ExceptionTarget
, or one of their extended variants. Both rooting and non-rooting targets exists, specific methods that returned unrooted data have been removed because methods that take a target can return rooted or unrooted data depending on the used target.Scope
andPartialScope
have been removed completely. -
Mutable references to
Output
implementTarget
, if used as aTarget
the returned data is rooted until the borrow ends. -
Methods of the
Gc
trait takeself
by reference. -
A ledger is used to track borrowed Julia data, instances of
Array
s andValue
s can be tracked. -
CCall::null_scope
andNullFrame
have been replaced withCCall::stackless_scope
. -
Ref::leak
andRef::data_ptr
have been added. -
async_util::task::sleep
has been added. -
When calling Julia functions, it can now be checked that none of the arguments are borrowed from Rust.
-
It's no longer possible to provide a backing channel for an async runtime.
-
A
nightly
feature is available to test the latest nightly Julia features. -
When the
nightly
feature is enabled, the async runtime can be started with additional worker threads. -
When the
nightly
feature is enabled, tasks are scheduled on one of the two available thread pools depending on the method. -
The
ForeignType
trait has been added which can be used to create new foreign types with custom mark functions. -
AsyncJulia::post_blocking_task
has been added, which can be used to schedule a blocking task on an arbitrary thread owned by Julia. -
PersistentTask::State
is a GAT, which gets rid of the lifetime-hack that allows the state to contain Julia data. -
Ref
wraps aNonNull
pointer to Julia data, like wrappers do. Undefinedness is expressed throughOption
. -
Uses of
ValidLayout
have been mostly replaced withValidField
.ValidField
is not implemented for mutable structs because they're not stored inline when used as a field of some other type. -
CCall::throw_exception
has been added and can be used to throw an exception from accall
ed function. -
Add
Affinity
so tasks can be explicitly scheduled on the main runtime thread. -
Global
has been renamed toUnrooted
.
- Support for Julia 1.7 has been dropped, by default Julia 1.8 is targeted.
-
jlrs can be used with 32-bits versions of Julia on Linux by enabling the
i686
feature. -
Methods that can catch exceptions thrown by Julia, eg
Module::set_const
, return aJlrsResult<JuliaResult<T>>
. -
The
Global
provided toPersistentTask::run
now has the'static
lifetime. -
The methods
AsyncFrame::relaxed_async_scope_(with_capacity)
have been added to work around the limitation thatAsyncFrame::relaxed_async_scope
can't return return data that lives shorter than the frame that created it. -
Elided lifetimes have been added to methods that create arrays with data borrowed from Rust, eg
Array::from_slice
. Such arrays can now be returned from async scopes whenAsyncFrame::relaxed_async_scope_(with_capacity)
is used. -
The number of threads can be set with
AsyncRuntimeBuilder::n_threads
when thelts
feature is enabled.
-
TemporarySymbol
has been renamed toToSymbol
. The methodToSymbol::to_symbol
has been added to this trait. -
The wrappers for
CodeInstance
,Expr
,MethodInstance
,MethodMatch
,MethodTable
,Method
,OpaqueClosure
,SSAValue
,TypemapEntry
,TypemapLevel
andWeakRef
are considered internal types, they are only available when theinternal-types
feature is enabled. -
Array::copy_inline_data
andTypedArray::copy_inline_data
require a reference to aFrame
. -
CopiedArray::splat
returns a boxed slice instead of aVec
. -
Align
,BitsUnionContainer
, andFlag
are sealed traits. -
All methods of the
Gc
trait are safe. -
Mutating Julia data is considered unsafe, as a result
Module::set_global
and related methods are unsafe. So are all methods that provide mutable access to array data. Unchecked methods are unsafe because not catching Julia exceptions is unsound when calling Rust from Julia. -
Array::as_typed_array
has been renamed toArray::try_as_typed
. -
Outputs reserve a slot in a frame and immediately set this slot when they're used. Multiple outputs can exists for the same frame simultaneously.
-
Methods like
Scope::value_scope
andAsyncFrame::async_value_scope
have been removed becauseFrame::scope
andAsyncFrame::async_scope
can return rooted data that outlives the frame. -
The
Scope
trait no longer has a'data
lifetime and most of its methods have been moved to theFrame
trait. TheScopeExt
trait has been removed completely,ScopeExt::scope_with_slots
has been renamed toFrame::scope_with_capacity
. ThePartialScope
trait has been added which allows calling methods that only need to root a single value with anOutput
. -
Methods that return rooted data return the appropriate type, eg
Array::new
returns anArray
. -
All pointer wrapper types provide a
root
method that can be used to safely extend their lifetime using anOutput
. -
The
AsUnrooted
trait has been removed. -
Most of the extensions defined in the extensions module have moved:
jlrs::extensions::f16
tojlrs::wrappers::inline::f16
.jlrs::extensions::ndarray
tojlrs::convert::ndarray
,jlrs::extensions::multitask
tojlrs::multitask
, andjlrs::extensions::pyplot
tojlrs::pyplot
. -
Pointer wrapper types don't implement
ValidLayout
, onlyRef
and inline wrappers do. -
Raw fields can be accessed with a
FieldAccessor
, theraw_field
methods have been removed. -
Add a
FieldIndex
trait which is used in combination with aFieldAccessor
to access arbitrary fields. -
A wrapper for
Nothing
/nothing
has been added. -
Dims::index_of
takesdim_index
by reference. -
Array::element_size
andTypedArray::element_size
have been added. -
DataType::field_type_unchecked
andDataType::field_index
have been added. -
GC::enable_logging
has been added. -
The
call
module has been moved fromjlrs::wrappers::ptr::call
tojlrs::call
. -
The
prelude
module can be disabled by opting out of the default features. -
The different runtimes have been moved to the
runtime
crate. Both the sync and async runtime can no longer be initialized directly, but require using aRuntimeBuilder
orAsyncRuntimeBuilder
. To create an async runtime an implementation ofAsyncRuntime
and a backing channel that implementsChannel
must be provided.AsyncRuntimeBuilder::start_async
is a sync function. -
All methods that send a new task to the async runtime take a
OneshotSender
and return an error rather than panicking if they fail. -
Like the async runtime, creating new
PersistentTask
s requires providing a backing channel. -
Array::reshape
is available for arrays that have data originating from Rust. Unchecked versions ofArray::reshape
,Array::grow_begin
,Array::grow_end
,Array::del_begin
, andArray::del_end
are available. -
Array::from_vec
andArray::from_slice
can return an error, unchecked versions are also available. -
A
TypedArray
can be created directly, and generally offers the same API asArray
does. -
Methods that take multiple values as
AsMut
now only needAsRef
because the data is never mutated from C. -
SimpleVector
no longer has a type to indicate the type of its contents because this property can't be checked withValidLayout
orTypecheck
. Instead, a type can now be provided when accessing the contents which is checked for compatibility at runtime. -
The
ValidLayout
trait has an associated constantIS_REF
to indicate whether the implementor is an inline or pointer wrapper type. -
Add
all-features-override
feature that disables thelts
anddebug
features whenall-features
istrue
. -
The contents
JlrsPyPlot.jl
are no longer evaluated automatically when thepyplot
feature has been enabled,PyPlot::init
must be called. -
The
Dims
trait andFrame
types are no longer included in the prelude. -
There's a single type that provides possibly mutable access to the contents of an array,
ArrayAccessor
, which replaces the large number of types that previously provided this access. A distinction is made between element types that are stored inline which have no and those that have some pointer fields. -
NdArray
has been split intoNdArrayView
andNdArrayViewMut
. Rather than a typed array, their trait methods take a (mutable) reference to anArrayAccessor
orCopiedArray
instead. -
JlrsError
has been split into several error types and unused variants have been removed. -
JuliaString::as_slice
has been renamed toJuliaString::to_bytes
,Symbol::as_slice
has been renamed toSymbol::as_bytes
. -
Symbol::new_bytes_unchecked
has been added. -
Closures and async trait methods that are called in a scope take a frame by value instead of by mutable reference. This gets rid of the need to reborrow the frame.
-
CallExt
has been renamed toProvideKeywords
,CallExt::with_keywords
toProvideKeywords::provide_keywords
. -
Type aliases for
Ref
have been moved to the module that also defines their associated pointer wrapper.